简体   繁体   中英

Error running Cordova android platform

I'm trying to create my first cordova hybrid app. I run it with the "cordova browser" pratform and the app run fine. Now, when i try to build the app for android the console show me the next error :

$ cordova build android
ANDROID_HOME=C:\Users\MyUser\AppData\Local\Android\sdk
JAVA_HOME=C:\Program Files\java\jdk1.8.0_121
Unzipping C:\Users\MyUser\.gradle\wrapper\dists\gradle-2.13-all\7hsc6vr6mi3i6i5m7                                                                                                                                                             q9hj4ci1q\gradle-2.13-all.zip to C:\Users\MyUser\.gradle\wrapper\dists\gradle-2.1                                                                                                                                                             3-all\7hsc6vr6mi3i6i5m7q9hj4ci1q
Exception in thread "main" java.lang.RuntimeException: java.util.zip.ZipExceptio                                                                                                                                                             n: error in opening zip file
        at org.gradle.wrapper.ExclusiveFileAccessManager.access(ExclusiveFileAcc                                                                                                                                                             essManager.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:219)
        at java.util.zip.ZipFile.<init>(ZipFile.java:149)
        at java.util.zip.ZipFile.<init>(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(ExclusiveFileAcc                                                                                                                                                             essManager.java:65)
        ... 3 more
Error: cmd: Command failed with exit code 1 Error output:
Exception in thread "main" java.lang.RuntimeException: java.util.zip.ZipExceptio                                                                                                                                                             n: error in opening zip file
        at org.gradle.wrapper.ExclusiveFileAccessManager.access(ExclusiveFileAcc                                                                                                                                                             essManager.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:219)
        at java.util.zip.ZipFile.<init>(ZipFile.java:149)
        at java.util.zip.ZipFile.<init>(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(ExclusiveFileAcc                                                                                                                                                             essManager.java:65)
        ... 3 more

Before, i was fixin others errors but with this, i don't know what i need to do. If a run the command "cordova requirements android" the console show that I have installed everything that I need. The output for that command is the next:

$ cordova requirements android
Error loading cordova-browser

Requirements check results for android:
Java JDK: installed 1.8.0
Android SDK: installed
Android target: installed android-14,android-16,android-18,android-22,android-23,android-24,android-25,Google Inc.:Google APIs:22,Google Inc.:Google APIs:23,Google Inc.:Google APIs:24
Gradle: installed

My project is on "React JS" and his libraries.

In your case, find this:

C:\\Users\\MyUser.gradle\\wrapper\\dists\\gradle-2.13- all\\7hsc6vr6mi3i6i5m7

now when you find it,delete the gradle-2.2.1-all.zip because this file is corrupted and then we'll replace for this http://services.gradle.org/distributions/gradle-2.2.1-all.zip when you finish all try again

cordova build android

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM