0

I have been trying to setup run my first react native project and have followed the steps provided here. But i keep getting this error when i run

$ react-native run-android

what i get is this

Starting JS server...
    Building and installing the app on the device (cd android && ./gradlew installDebug)...
    Unzipping /home/webshinobis/.gradle/wrapper/dists/gradle-2.4-all/6r4uqcc6ovnq6ac6s0txzcpc0/gradle-2.4-all.zip to /home/webshinobis/.gradle/wrapper/dists/gradle-2.4-all/6r4uqcc6ovnq6ac6s0txzcpc0
    Exception 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: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: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)
Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
https://facebook.github.io/react-native/docs/android-setup.html

I have searched and all i have seen so far are genymotion user solutions.

Any idea on how to fix this?

2 Answers 2

2

Oh, i found the error, the zip file in

/home/webshinobis/.gradle/wrapper/dists/gradle-2.4-all/6r4uqcc6ovnq6ac6s0txzcpc0/gradle-2.4-all.zip

was corrupt that's y it could not be unzipped by the java. So I have to go into the folder and delete the zip file mannualy and then run

react-native run-android

again. Hope that helps someone else. This is usually due to internet connection issues.

Sign up to request clarification or add additional context in comments.

Comments

0

Set your ANDROID_HOME environment variables. Check your adb devices first. If your device is available. See the cyprusglobe suggestion.

Run:

- chmod 755 android/gradlew
- react-native run-android

1 Comment

If you are using the latest Android Studio, set the latest buildToolsVersion in your build.gradle file.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.