https://github.com/infil00p/cordova-crosswalk-engine
从npm(版本> = 4.2.0)安装最新版本的Cordova CLI:
$ npm install -g cordova
使用cordova创建一个项目,例如创建HelloWorld
$ cordova create hello com.example.hello HelloWorld
导航到项目文件夹:
$ cd hello
添加Android平台@ 4.0.0-dev
$ cordova platform add https://github.com/apache/cordova-android.git
添加Crosswalk引擎插件:
$ cordova plugin add https://github.com/MobileChromeApps/cordova-crosswalk-engine.git
构建
$ cordova build android
sai:hello zhangsailei$ cordova build android
Running command: /Users/zhangsailei/hello/platforms/android/cordova/build
ANDROID_HOME=/Applications/adt-bundle-mac-x86_64-20140321/sdk
JAVA_HOME=/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
Running: /Users/zhangsailei/hello/platforms/android/gradlew cdvBuildDebug -b /Users/zhangsailei/hello/platforms/android/build.gradle -Dorg.gradle.daemon=true
Unzipping /Users/zhangsailei/.gradle/wrapper/dists/gradle-2.2.1-all/2m8005s69iu8v0oiejfej094b/gradle-2.2.1-all.zip to /Users/zhangsailei/.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:128)
at java.util.zip.ZipFile.<init>(ZipFile.java:145)
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
/Users/zhangsailei/hello/platforms/android/cordova/node_modules/q/q.js:126
throw e;
^
Error code 1 for command: /Users/zhangsailei/hello/platforms/android/gradlew with args: cdvBuildDebug,-b,/Users/zhangsailei/hello/platforms/android/build.gradle,-Dorg.gradle.daemon=true
ERROR building one of the platforms: Error: /Users/zhangsailei/hello/platforms/android/cordova/build: Command failed with exit code 1
You may not have the required environment or OS to build this project
Error: /Users/zhangsailei/hello/platforms/android/cordova/build: Command failed with exit code 1
at ChildProcess.whenDone (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:131:23)
at ChildProcess.emit (events.js:110:17)
at maybeClose (child_process.js:1008:16)
at Process.ChildProcess._handle.onexit (child_process.js:1080:5)
答案 0 :(得分:0)
我知道你已经解决了,但这个答案更真实,我希望这能帮到别人。 你可以使用this question的接受答案。但是所有这一切都是你应该下载gradle 2.2.1-all.zip并将其粘贴到项目中然后从build.js中调用它。 它对我有用。