我已设置了所有必需的环境。确认我使用命令
检查了构建android的要求cordova requirements
,结果如下
Requirements check results for android:
Java JDK: installed 1.8.0
Android SDK: installed true
Android target: installed android-26,android-25,android-24,Google
Inc.:Google API:24,android-23
Gradle: installed C:\Program Files\Android\Android Studio\gradle\gradle-3.2\bin\gradle
当我尝试使用命令构建apk时
ionic cordova build android
得到如下
> ionic cordova prepare
> cordova prepare
- Running command [12:17:44] lint finished in 4.70 s
√ Running command - done!
> cordova build android
× Running command - failed!
[ERROR] An error occurred while running cordova build android (exit code 1):
ANDROID_HOME=C:\Users\Arunkumar.DESKTOP-59TSCLF\AppData\Local\Android\sdk
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_144
The system cannot find the path specified.
Error: cmd: Command failed with exit code 1
答案 0 :(得分:0)
以前我也遇到过这个问题。我通过这种方式解决了我的问题。我在C:\ Program Files \ gradle \ gradle-3.3中安装了Gradle。我像那样设置了Gradle路径
GRADLE_HOME C:\ Program Files \ gradle \ gradle-3.3
添加路径C:\ Program Files \ gradle \ gradle-3.3 \ bin