Meteor 1.3 build cordova app for android fails with following message

hi there it’s been two days since im facing this issue.ive been trying to convert a web app made with responsive design and build the apk for mobile testing on android but each time it fails here is the message i get…

`Executing “after_prepare” hook for all plugins.
% Executing “before_compile” hook for all plugins.
ANDROID_HOME=/Users/zehijeanjacquesthibaut/Library/Android/sdk
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_91.jdk/Contents/Home
Unzipping /Users/zehijeanjacquesthibaut/.gradle/wrapper/dists/gradle-2.2.1-all/2m8005s69iu8v0oiejfej094b/gradle-2.2.1-all.zip to /Users/zehijeanjacquesthibaut/.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.(ZipFile.java:219)
at java.util.zip.ZipFile.(ZipFile.java:149)
at java.util.zip.ZipFile.(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: /Users/zehijeanjacquesthibaut/Desktop/TRIZ_DIGITAL/WEBAPPS_MOBILE_APPS/zfoodapp/.meteor/local/cordova-build/platforms/android/gradlew with args: cdvBuildRelease,-b,/Users/zehijeanjacquesthibaut/Desktop/TRIZ_DIGITAL/WEBAPPS_MOBILE_APPS/zfoodapp/.meteor/local/cordova-build/platforms/android/build.gradle,-Dorg.gradle.daemon=true,-Pandroid.useDeprecatedNdk=true
You may not have the required environment or OS to build this project
=> Errors executing Cordova commands:

While building Cordova app for platform Android:
Error code 1 for command: /Users/zehijeanjacquesthibaut/Desktop/TRIZ_DIGITAL/WEBAPPS_MOBILE_APPS/zfoodapp/.meteor/local/cordova-build/platforms/android/gradlew with
args:
cdvBuildRelease,-b,/Users/zehijeanjacquesthibaut/Desktop/TRIZ_DIGITAL/WEBAPPS_MOBILE_APPS/zfoodapp/.meteor/local/cordova-build/platforms/android/build.gradle,-Dorg.gradle.daemon=true,-Pandroid.useDeprecatedNdk=true
`

please help guys what should i do?if i cant get it running on the mobile phone ill lose a potential big client of mine :anguished:

Do you have the correct Android SDK installed? Android 6 API 23 ?

Also are you trying to install the app with the command meteor run android-device --mobile-server http://your.local.host:port This is what makes it easy on Android devices

@flean yeah i have it installed the sdk manager shows the top 3 tools installed.
i just ran this command:
meteor build ../zfoodapp --server localhost:3000
so you mean i should run it like you wrote above?

@flean also i tried to run it on the emulator but it is far to slow to load that is why i want to directly try it on my device …i am on mac os el capitan and i dont know why but the command meteor run android-device cant find my device but i assure you my friend it is plugged in and the developper mode is on …i really need some help…the app is just a simple demo app so that i can show my client how awesome meteor is for coding once and deploy mostly everywhere but i cant even build an apk and if i show him the webapp i will surely get fired…lol

fire up chrome and put this in the url chrome://inspect/#devices
do you see the device? Also, you need to put your local ip address in the server not localhost. Make sure the device is on the same wifi network.

@flean i ran this command with my local address
meteor run android-device --mobile-server <my ip address>:3000

and here is what the console shows

`=> Errors executing Cordova commands:

While running Cordova app for platform Android with options --device:
Error: Command failed:
f:\TRIZ_DIGITAL\WEBAPPS\zfoodapp.meteor\local\cordova-build\platforms\android\cordova\run
–device --device

at ChildProcess.exitCallback (C:\tools\utils\processes.js:151:23)
at ChildProcess.emit (events.js:98:17)
at Process.ChildProcess._handle.onexit (child_process.js:820:12)

C:\Users\TRIZ DIGITAL\AppData\Local.meteor\packages\meteor-tool\1.3.2_4\mt-os.windows.x86_32\isopackets\cordova-support\npm\node_modules\meteor\promise\node_modules\meteor-promise\promise_server.js:116
throw error;
^
ExitWithCode:1`

i switched to my windows pc which is faster

here iswhat i get trying to build my app’s apk on windows

$ meteor build f:\TRIZ_DIGITAL\WEBAPPS\BUILDS --server 41.66.53.27:3000
ANDROID_HOME=C:\Users\TRIZ DIGITAL\AppData\Local\Android\sdk
JAVA_HOME=C:\Program Files\java\jdk1.8.0_91
Downloading http://services.gradle.org/distributions/gradle-2.2.1-all.zip
Building Cordova app for Android
Unzipping C:\Users\TRIZ DIGITAL.gradle\wrapper\dists\gradle-2.2.1-all\2m8005s69iu8v0oiejfej094b\gradle-2.2.1-all.zip to C:\Users\TRIZ DIGITAL.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.(ZipFile.java:219)
at java.util.zip.ZipFile.(ZipFile.java:149)
at java.util.zip.ZipFile.(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
=> Errors executing Cordova commands:

While building Cordova app for platform Android:
Error code 1 for command: cmd with args:
/s,/c,“f:\TRIZ_DIGITAL\WEBAPPS\zfoodapp.meteor\local\cordova-build\platforms\android\gradlew
cdvBuildRelease -b
f:\TRIZ_DIGITAL\WEBAPPS\zfoodapp.meteor\local\cordova-build\platforms\android\build.gradle
-Dorg.gradle.daemon=true -Pandroid.useDeprecatedNdk=true”

:anguished: :anguished: :anguished: im going crazy

@flean i looked for a similar problem issue on the forum and i found this solution…

“For my issue rm -rf ~/.gradle solved it.”

It seems the building process stops for me when it hits the gradle download and gives a zip exception.As im kindof a newbie with macs ,can you show me how to run the above.thanks

This is the above-mentioned forum post: Meteor 1.2.0.2 android problem

Unfortunately that didn’t work for me.

i manually fixed it by downloading gradle myself into the folder on my mac and the rest of the build process went as smooth as expected

Removing ~/.gradle directly fixed it for me.
rm -rf ~/.gradle