Ionic Build Android 失败

标签: Java Android
发布时间: 2016/9/26 3:29:13
注意事项: 本文中文内容可能为机器翻译,如要查看英文原文请点击上面连接.

真的困在大厦 IonicAndroid

系统信息

Cordova CLI: 5.3.3
Ionic Version: 1.1.0
Ionic CLI Version: 1.7.7
Ionic App Lib Version: 0.6.3
ios-deploy version: Not installed
ios-sim version: Not installed
OS: Mac OS X El Capitan
Node Version: v0.12.6
Xcode version: Xcode 7.0.1 Build version 7A1001 

当我运行

$ ionic build android

它产生

Running command: /Users/umer/Workspace/Ionic/blank/hooks/after_prepare/010_add_platform_class.js /Users/umer/Workspace/Ionic/blank
add to body class: platform-android
Running command: /Users/umer/Workspace/Ionic/blank/hooks/after_prepare/020_remove_sass_from_platforms.js /Users/umer/Workspace/Ionic/blank
Running command: /Users/umer/Workspace/Ionic/blank/platforms/android/cordova/build 
ANDROID_HOME=/Users/umer/Documents/android-sdk-macosx
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_31.jdk/Contents/Home
Running: /Users/umer/Workspace/Ionic/blank/platforms/android/gradlew cdvBuildDebug -b /Users/umer/Workspace/Ionic/blank/platforms/android/build.gradle -Dorg.gradle.daemon=true
Exception in thread "main" java.lang.RuntimeException: Timeout of 120000 reached waiting for exclusive access to file: /var/root/.gradle/wrapper/dists/gradle-2.2.1-all/2m8005s69iu8v0oiejfej094b/gradle-2.2.1-all.zip
    at org.gradle.wrapper.ExclusiveFileAccessManager.access(ExclusiveFileAccessManager.java:61)
    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)

/Users/umer/Workspace/Ionic/blank/platforms/android/cordova/node_modules/q/q.js:126
                    throw e;
                          ^
Error code 1 for command: /Users/umer/Workspace/Ionic/blank/platforms/android/gradlew with args: cdvBuildDebug,-b,/Users/umer/Workspace/Ionic/blank/platforms/android/build.gradle,-Dorg.gradle.daemon=true
ERROR building one of the platforms: Error: /Users/umer/Workspace/Ionic/blank/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/umer/Workspace/Ionic/blank/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:139:23)
    at ChildProcess.emit (events.js:110:17)
    at maybeClose (child_process.js:1015:16)
    at Process.ChildProcess._handle.onexit (child_process.js:1087:5)

我已经试过更改 var distributionUrl = 'distributionUrl=http\\://services.gradle.org/distributions/gradle-2.2.1-all.zip';point 到当地分布,但它看起来不到指定 path 但考虑项目的 android 目录。

当我 build 使用 Ant

cordova build android -- --ant

它成功生成,但我不能去 build 方式文档在暗示。

我已经跟随 ionic build android 错误时下载 gradle

解决方法 1:

我得到了这个错误,当我奔跑 android 命令几次。我跑了 (在 Linux):

ps aux | grep -i android

我发现了 android 命令运行不止一次。

我打了

sudo kill -9 (ids of running android(s) )

看来 android 否认 ionic gradle 访问。

官方微信
官方QQ群
31647020