ionic4 android打包

打包命令

ionic cordova build android

 

错误1:

Could not find an installed version of Gradle either in Android Studio,
or on your system to install the gradle wrapper. Please include gradle 
in your path, or install Android Studio

配置全局环境变量

PATH 最后加上gradle所在路径:D:\gradle-x.x\bin

 

错误2:

No installed build tools found. Install the Android build tools version 19.1.0 or higher.

新建一个环境变量 ANDROID_HOME=D:\android-sdk(android sdk所在目录)

PATH 最后加上

%ANDROID_HOME%\tools
%ANDROID_HOME%\platform-tools

 

错误3:

error: resource android:attr/fontVariationSettings not found.

如果build的时候出现 resource xxx not found 的情况可以试试安装这个 (估计是升级了gradle 5~)

cordova plugin add cordova-android-support-gradle-release --variable ANDROID_SUPPORT_VERSION=27.0.0
 

 

PS:

设置完环境变量,关闭cmd或powershell窗口
重新打开
重新build

你可能感兴趣的:(ionic4 android打包)