常见问题一:
Run with --stacktrace option to get the stack . Run with --info or --debug option to get more log output.
Error: cmd: Command failed with exit code 1 Error output:trace
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'android'.
> Could not resolve all dependencies for configuration ':classpath'.
> Could not download gradle-core.jar (com.android.tools.build:gradle-core:2.2.2)
> Could not get resource 'https://jcenter.bintray.com/com/android/tools/build/gradle-core/2.2.2/gradle-core-2.2.2.jar'.
> Could not GET 'https://jcenter.bintray.com/com/android/tools/build/gradle-core/2.2.2/gradle-core-2.2.2.jar'.
> d29vzk4ow07wi7.cloudfront.net
解决方法:
因为无法从jcenter中下载到这个jar包,所以需要在项目目录platform/android/CordovaLib/
找到build.gradle文件,打开编辑,找到buildscript 做如下修改:
注释jcenter(),修改maven url 改为 “http://maven.aliyun.com/nexus/content/groups/public/”
常见问题二:
C:\test\hello> cordova build android
ANDROID_HOME=C:\Users\kongxx\AppData\Local\Android\sdk
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_121
Error: Could not find gradle wrapper within Android SDK. Might need to update your Android SDK.
解决办法:
1.如果已经安装了Android Studio:
- 复制templates目录:C:\Program Files\Android\Android Studio\plugins\android\lib\templates
- 粘贴至如下目录:C:\Users\<user-name>\AppData\Local\Android\sdk\tools
2.没有安装Android Studio:
- 下载 Android SDK tools package(https://dl.google.com/android/repository/tools_r25.2.3-windows.zip)并解压
- 进入 C:\Users\<user-name>\AppData\Local\Android\sdk目录并备份tools目录
- 将package压缩包中的tools目录解压到这个目录下
常见问题三:
Error: Android SDK not found. Make sure that it is installed. If it is not at the default location, set the ANDROID_HOME environment variable.
Cordova Android版本问题,需要安卓新的版本,我这里是Cordova platform add android@6.5.0
https://www.cnblogs.com/lrxsblog/p/7007092.html