我的系统上安装了Cordova,NPM,NodeJS,Ant,JDK以及Android ADK,以构建Android应用程序。
为所有返回预期结果运行--version
或-v
或-version
标记
NPM = 1.3.10
NodeJS = v0.10.25
Ant = 1.9.3
Java = 1.8.0_72
Cordova = 6.0.0
但是当我尝试默认的cordova hello world程序时,我无法构建一个Android应用程序
cordova create hello com.example.hello HelloWorld
使用hello dir创建necassary cordova项目并返回
Creating a new cordova project.
没有错误所以我可以打成你好 在hello dir中添加android平台返回没有我可以检测到的错误
cordova platform add android
然后返回,
Adding android project...
Creating Cordova project for the Android platform:
Path: platforms/android
Package: com.example.hello
Name: HelloWorld
Activity: MainActivity
Android target: android-23
Android project created with cordova-android@5.1.0
Discovered plugin "cordova-plugin-whitelist" in config.xml. Installing to the project
Fetching plugin "cordova-plugin-whitelist@1" via npm
Installing "cordova-plugin-whitelist" for android
This plugin is only applicable for versions of cordova-android greater than 4.0. If you have a previous platform version, you do *not* need this plugin since the whitelist will be built in.
一切都按照预期运行,但是建立了cordova项目
cordova build android
返回以下错误,NB我的Android SDK是最新的,已经安装了API 10,19和23
ANDROID_HOME=/home/lyndon/Software/android-sdk-linux
JAVA_HOME=/usr/lib/jvm/java-8-oracle
Unzipping /home/lyndon/.gradle/wrapper/dists/gradle-2.2.1-all/2m8005s69iu8v0oiejfej094b/gradle-2.2.1-all.zip to /home/lyndon/.gradle/wrapper/dists/gradle-2.2.1-all/2m8005s69iu8v0oiejfej094b
Exception in thread "main" java.lang.RuntimeException: java.util.zip.ZipException: error in opening zip file
at org.gradle.wrapper.ExclusiveFileAccessManager.access(ExclusiveFileAccessManager.java:78)
at org.gradle.wrapper.Install.createDist(Install.java:47)
at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:129)
at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:48)
Caused by: java.util.zip.ZipException: error in opening zip file
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.<init>(ZipFile.java:219)
at java.util.zip.ZipFile.<init>(ZipFile.java:149)
at java.util.zip.ZipFile.<init>(ZipFile.java:163)
at org.gradle.wrapper.Install.unzip(Install.java:160)
at org.gradle.wrapper.Install.access$400(Install.java:29)
at org.gradle.wrapper.Install$1.call(Install.java:70)
at org.gradle.wrapper.Install$1.call(Install.java:47)
at org.gradle.wrapper.ExclusiveFileAccessManager.access(ExclusiveFileAccessManager.java:65)
... 3 more
ERROR building one of the platforms: Error code 1 for command: /home/lyndon/Documents/UCT/iCOMMS/hello/hello/platforms/android/gradlew with args: cdvBuildDebug,-b,/home/lyndon/Documents/UCT/iCOMMS/hello/hello/platforms/android/build.gradle,-Dorg.gradle.daemon=true,-Pandroid.useDeprecatedNdk=true
You may not have the required environment or OS to build this project
Error: Error code 1 for command: /home/lyndon/Documents/UCT/iCOMMS/hello/hello/platforms/android/gradlew with args: cdvBuildDebug,-b,/home/lyndon/Documents/UCT/iCOMMS/hello/hello/platforms/android/build.gradle,-Dorg.gradle.daemon=true,-Pandroid.useDeprecatedNdk=true
如果您对如何排除故障有所了解,我真的很感激一些帮助。