ionic打包apk的时候Android API版本不合适出现的问题

在用ionic打包apk之前,要给ionic项目添加Android平台的支持,用一下命令添加:

ionic platform add android

注意:当我们用上面的指令添加Android平台支持以后,有可能你的下载的sdk里面没有相对应API,肯能出现下面的错误:

 What went wrong:
A problem occurred configuring root project 'android'.
> You have not accepted the license agreements of the following SDK components:
[Android SDK Platform 25].
Before building your project, you need to accept the license agreements and complete the installation of the missing components using the Android Studio SDK Manager.
Alternatively, to learn how to transfer the license agreements from one workstation to another, go to http://d.android.com/r/studio-ui/export-licenses.html

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

我们在添加Android平台的时候可以手动的指定API的版本,指令如下:

ionic platform add [email protected]

上面指令是给项目添加Android5.1的版本了,之后打包就不会出问题了。

(添加你自己电脑安装的API版本就行,不一定是我写的5.1.1)


你可能感兴趣的:(ionic,Android)