Building Ionic app with CLI Does Not Work

Hello everybody! I have a problem with building my app with ionic in the CLI. Here is the error code that I get when I type “ionic build” in my app directory:

Your environment has been set up for using Node.js 0.12.4 (x64) and npm.

C:\Users\Singh>cd C:\Users\Singh\TapTap!\platforms\android\cordova

C:\Users\Singh\TapTap!\platforms\android\cordova>build.bat --debug
ANDROID_HOME=C:\Users\Singh\AppData\Local\Android\sdk
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_40
Running: C:\Users\Singh\TapTap!\platforms\android\gradlew cdvBuildDebug -b C:\Us
ers\Singh\TapTap!\platforms\android\build.gradle -Dorg.gradle.daemon=true
Exception in thread "main" java.lang.RuntimeException: Could not determine wrapp
er version.
        at org.gradle.wrapper.GradleWrapperMain.wrapperVersion(GradleWrapperMain
.java:106)
        at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:48)
Caused by: java.lang.RuntimeException: No build receipt resource found.
        at org.gradle.wrapper.GradleWrapperMain.wrapperVersion(GradleWrapperMain
.java:92)
        ... 1 more

C:\Users\Singh\TapTap!\platforms\android\cordova\node_modules\q\q.js:126
                    throw e;
                          ^
Error code 1 for command: cmd with args: /s /c "C:\Users\Singh\TapTap!\platforms
\android\gradlew cdvBuildDebug -b C:\Users\Singh\TapTap!\platforms\android\build
.gradle -Dorg.gradle.daemon=true"

C:\Users\Singh\TapTap!\platforms\android\cordova>

Can somebody please help me? I do not no what i am doing wrong.

Can you trying running ionic build android and cordova build android?
Also, can you run ionic info and paste the output here?

I have the same the problem.

Here is my ionic info

Cordova CLI: 5.1.1
Ionic Version: 1.0.0
Ionic CLI Version: 1.5.0
Ionic App Lib Version: 0.1.0
ios-deploy version: Not installed
ios-sim version: 3.1.1
OS: Mac OS X Yosemite
Node Version: v0.12.4
Xcode version: Xcode 6.3.2 Build version 6D2105

I tried cordova build android

and it shows the same error:
Error: Could not find or load main class org.gradle.wrapper.GradleWrapperMain

Hmm, that’s interesting. Could try a fresh project and see if it gives you there error?

I tried a new one. I uninstalled and re-installed everything, cordova, ionic, node and still I get the same problem.

Hmm, alright, would you be able to open an issue on our cli repo.

Thanks :slight_smile: Done. Available here: https://github.com/driftyco/ionic-cli/issues/478

Has the issue been fixed? Oh and by the way this is what appears when I type ionic info:

C:\Users\Singh\TapTap!>ionic info

Your system information:

Cordova CLI: 5.1.1
Ionic Version: 1.0.0
Ionic CLI Version: 1.5.0
Ionic App Lib Version: 0.1.0
OS: Windows 7 SP1
Node Version: v0.12.4

I found the issue! (its the exclamation mark). Remove the exclamation mark from your folder name and try it again. Hope this helps :slight_smile:

2 Likes

Did the trick for me!

ionic build error
I found this error.
When i build my app ionic build android following the errors i found.how to solve this problem?

periyasamy@Periyasamy:~/Desktop/LoginCtrl$ ionic build android
WARN: ionic.project has been renamed to ionic.config.json, please rename it.
Running command: /home/periyasamy/Desktop/LoginCtrl/hooks/after_prepare/010_add_platform_class.js /home/periyasamy/Desktop/LoginCtrl

add to body class: platform-android

ANDROID_HOME=/opt/android-sdk

JAVA_HOME=/usr/lib/jvm/default-java

Deleting directory /home/periyasamy/.gradle/wrapper/dists/gradle-2.13-all/7hsc6vr6mi3i6i5m7q9hj4ci1q/gradle-2.13

Unzipping /home/periyasamy/.gradle/wrapper/dists/gradle-2.13-all/7hsc6vr6mi3i6i5m7q9hj4ci1q/gradle-2.13-all.zip to /home/periyasamy/.gradle/wrapper/dists/gradle-2.13-all/7hsc6vr6mi3i6i5m7q9hj4ci1q

Exception in thread "main"
java.lang.RuntimeException: java.util.zip.ZipException: invalid code lengths set
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: invalid code lengths set
at java.util.zip.InflaterInputStream.read(InflaterInputStream.java:164)
at java.io.FilterInputStream.read(FilterInputStream.java:107)
at org.gradle.wrapper.Install.copyInputStream(Install.java:189)
at org.gradle.wrapper.Install.unzip(Install.java:175)
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: /home/periyasamy/Desktop/LoginCtrl/platforms/android/gradlew: Command failed with exit code 1 Error output:
Exception in thread “main” java.lang.RuntimeException: java.util.zip.ZipException: invalid code lengths set
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: invalid code lengths set
at java.util.zip.InflaterInputStream.read(InflaterInputStream.java:164)
at java.io.FilterInputStream.read(FilterInputStream.java:107)
at org.gradle.wrapper.Install.copyInputStream(Install.java:189)
at org.gradle.wrapper.Install.unzip(Install.java:175)
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

Thank you…that solved my problem too…I had & in my folder name…removing it resolved the issue

sir i have a some error in ionic 4 …

FAILURE: Build failed with an exception.

  • What went wrong:
    Could not determine java version from ‘10.0.2’.

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

  • Get more help at https://help.gradle.org
    /home/appuser/ionic4gen/platforms/android/gradlew: Command failed with exit code 1 Error output:
    FAILURE: Build failed with an exception.

  • What went wrong:
    Could not determine java version from ‘10.0.2’.

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

  • Get more help at https://help.gradle.org
    [ERROR] An error occurred while running subprocess cordova.

      cordova build android --release exited with exit code 1.
    
      Re-running this command with the --verbose flag may provide more information.

Please I have the same issue, point me to the folder with this exclamation mark.
Thanks