Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: ionic build android failed #4581

Closed
mumer92 opened this issue Oct 31, 2015 · 10 comments
Closed

bug: ionic build android failed #4581

mumer92 opened this issue Oct 31, 2015 · 10 comments

Comments

@mumer92
Copy link

mumer92 commented Oct 31, 2015

Type: bug

Platform: android 4.x webview

I am really stuck on building ionic for android

System Information

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 

When I run

$ ionic build android

it produces

 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)

I have tried changing var distributionUrl = 'distributionUrl=http\\://services.gradle.org/distributions/gradle-2.2.1-all.zip'; to point it to local distribution but it does not look into specified path but look into project's android directory.

When I build using Ant

cordova build android -- --ant

It builds successfully but I am unable to build the way docs are suggesting.

@mumer92 mumer92 changed the title ionic build android failed bug: ionic build android failed Oct 31, 2015
@ahayder
Copy link

ahayder commented Nov 10, 2015

Same problem here.

@Suresh-R-S
Copy link

Similar type of error....

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.(ZipFile.java:215)
at java.util.zip.ZipFile.(ZipFile.java:145)
at java.util.zip.ZipFile.(ZipFile.java:159)
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

/home/experion/ionic_project/test/platforms/android/cordova/node_modules/q/q.js:126
throw e;
^
Error code 1 for command: /home/experion/ionic_project/test/platforms/android/gradlew with args: cdvBuildDebug,-b,/home/experion/ionic_project/test/platforms/android/build.gradle,-Dorg.gradle.daemon=true
ERROR building one of the platforms: Error: /home/experion/ionic_project/test/platforms/android/cordova/build: Command failed with exit code 1
You may not have the required environment or OS to build this project
Error: /home/experion/ionic_project/test/platforms/android/cordova/build: Command failed with exit code 1
at ChildProcess.whenDone (/usr/local/npm/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)

@Suresh-R-S
Copy link

@mumer92 and @ahayder was the issue solved??

@gilhanan
Copy link

I had similar problem, I'm not sure its problem with ionic, i think cordova-gradle conflict

changing distributionUrl to:

var distributionUrl = 'distributionUrl=http\\://services.gradle.org/distributions/gradle-2.3-all.zip';

solved it.

This was the error log:

vagrant@ionic-android:vagrant [git:master *+]> cordova build
Running command: /vagrant/hooks/after_prepare/010_add_platform_class.js /vagrant
add to body class: platform-android
Running command: /vagrant/platforms/android/cordova/build
ANDROID_HOME=/home/vagrant/android-sdk-linux
JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64
Running: /vagrant/platforms/android/gradlew cdvBuildDebug -b /vagrant/platforms/android/build.gradle -Dorg.gradle.daemon=true
Downloading http://services.gradle.org/distributions/gradle-2.2.2-all.zip

Exception in thread "main" java.lang.RuntimeException: java.io.FileNotFoundException: http://downloads.gradle.org/distributions/gradle-2.2.2-all.zip
        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.io.FileNotFoundException: http://downloads.gradle.org/distributions/gradle-2.2.2-all.zip
        at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1626)
        at org.gradle.wrapper.Download.downloadInternal(Download.java:59)
        at org.gradle.wrapper.Download.download(Download.java:45)
        at org.gradle.wrapper.Install$1.call(Install.java:60)
        at org.gradle.wrapper.Install$1.call(Install.java:47)
        at org.gradle.wrapper.ExclusiveFileAccessManager.access(ExclusiveFileAccessManager.java:65)
        ... 3 more

/vagrant/platforms/android/cordova/node_modules/q/q.js:126
                    throw e;
                    ^
Error code 1 for command: /vagrant/platforms/android/gradlew with args: cdvBuildDebug,-b,/vagrant/platforms/android/build.gradle,-Dorg.gradle.daemon=true
ERROR building one of the platforms: Error: /vagrant/platforms/android/cordova/build: Command failed with exit code 1
You may not have the required environment or OS to build this project
Error: /vagrant/platforms/android/cordova/build: Command failed with exit code 1

@edamon
Copy link

edamon commented Nov 25, 2015

+1. I've tried removing the \ from distributionUrl according to an SO post, it did not work. I can build using cordova but I cannot deploy using ionic run android

@mumer92
Copy link
Author

mumer92 commented Nov 26, 2015

No, The work around solution is to change point grade to local distribution by changing destinationUrl, but it really isn't the solution.

@mlynch
Copy link
Contributor

mlynch commented Dec 6, 2015

Interesting, sounds like a cordova issue (so, going to close for now), but feel free to continue the discussion in case others find this issue with similar problems.

@mlynch mlynch closed this as completed Dec 6, 2015
@navintech93
Copy link

navintech93 commented Mar 23, 2017

  • This is because of gradle error Download the file
  • http://services.gradle.org/distributions/gradle-2.14.1-all.zip
  • and extract it in any of directory and set the path by open cmd and enter
  • setx path (extracted directory)/bin
  • after reopen cmd and check whether the gradle is works or not by give
  • gradle -v
  • it shows the gradle version output .
  • Now the error is fixed run
  • ionic build android

@alshakhsmustafa
Copy link

Hi, unfortunately still have the same problem and same error message after installing gradle
although when I run.
gradle -v,
i get this


Gradle 2.10

Build time: 2016-01-26 15:17:49 UTC
Build number: none
Revision: UNKNOWN

Groovy: 2.4.5
Ant: Apache Ant(TM) version 1.9.6 compiled on July 8 2015
JVM: 1.8.0_151 (Oracle Corporation 25.151-b12)
OS: Linux 4.4.0-57-generic amd64**

@ionitron-bot
Copy link

ionitron-bot bot commented Sep 1, 2018

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.

@ionitron-bot ionitron-bot bot locked and limited conversation to collaborators Sep 1, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants