Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

react-native run-android Exception in thread "main" java.util.zip.ZipException: error in opening zip file

I try to

react-native run-android 

and meet this problem

JS server already running.
Running C:\Users\丶丶困困兽兽犹犹斗斗\AppData\Local\Android\sdk/platform-tools/adb -s 192.168.76.101:5555 reverse tcp:8081 tcp:8081
Building and installing the app on the device (cd android && gradlew.bat installDebug...
Unzipping C:\Users\丶丶困困兽兽犹犹斗斗\.gradle\wrapper\dists\gradle-2.4-all\6r4uqcc6ovnq6ac6s0txzcpc0\gradle-2.4-all.zip to C:\Users\丶丶困困兽兽犹犹斗斗\.gradle\wrapper\dists\gradle-2.4-all\6r4uqcc6ovnq6ac6s0txzcpc0Exception in thread "main"    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:114)
    at java.util.zip.ZipFile.<init>(ZipFile.java:131)
    at org.gradle.wrapper.Install.unzip(Install.java:159)
    at org.gradle.wrapper.Install.access$500(Install.java:26)
    at org.gradle.wrapper.Install$1.call(Install.java:69)
    at org.gradle.wrapper.Install$1.call(Install.java:46)
    at org.gradle.wrapper.ExclusiveFileAccessManager.access(ExclusiveFileAccessManager.java:65)
    at org.gradle.wrapper.Install.createDist(Install.java:46)
    at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:126)
    at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:61)

SDK works well and can find device in adb devices

like image 980
Wenpeng Qu Avatar asked Nov 26 '16 03:11

Wenpeng Qu


3 Answers

The problem is Unable to Unzip your gradle-2.4-all.zip, So please Delete the existing file

gradle-2.4-all.zip

from your folder :

C:\Users\丶丶困困兽兽犹犹斗斗.gradle\wrapper\dists\gradle-2.4-all\6r4uqcc6ovnq6ac6s0txzcpc0\

Download a fresh gradle-2.4-all.zip file and place it on the same folder as we deleted and try again to run your code : react-native run-android

It may work.You can download gradle zip file from the below Link: https://services.gradle.org/distributions

like image 119
Muhammed Suhail Avatar answered Nov 12 '22 08:11

Muhammed Suhail


I have the same problem as yours! Because when I first run "react-native run-android", my INTERNET is SLOW and LAG, CORRUPTED. This bad internet connection lets to download a TEMPORARY DAMAGE file gradle....zip. Solution: Just go in that path contains that file zip, delete it then run again! It worked for me!

like image 12
Thien Nhan Nguyen Avatar answered Nov 12 '22 09:11

Thien Nhan Nguyen


Well, I meet the same problem.

I use this method solve it.

I input: sudo react-native run-android

then the Terminal show :

java.lang.RuntimeException: SDK location not found. Define location with sdk.dir in the local.properties file or with an ANDROID_HOME environment variable.

So I copy a "local.properties" from an existing Android project and put it in this project.

And then,I input sudo react-native run-android again.

like image 5
Mr.Fish Avatar answered Nov 12 '22 08:11

Mr.Fish