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?
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.
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
Related
When I run cordova build android I had error.
exit /b 1 Command finished with error code 1:\platforms\android\gradlew cdvBuildDebug,-b,myprodplatforms\android\build.gradle myprodplatforms\android\gradlew: Command failed with exit code 1 Error output: Exception in thread "main" java.lang.NullPointerException
at org.gradle.wrapper.PathAssembler.getDistName(PathAssembler.java:84)
at
org.gradle.wrapper.PathAssembler.getDistribution(PathAssembler.java:40)
at org.gradle.wrapper.Install.createDist(Install.java:44)
at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:107)
at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:63) Error: myprodplatforms\android\gradlew: Command failed with exit code 1 Error output: Exception in thread "main" java.lang.NullPointerException
at org.gradle.wrapper.PathAssembler.getDistName(PathAssembler.java:84)
at org.gradle.wrapper.PathAssembler.getDistribution(PathAssembler.java:40)
at org.gradle.wrapper.Install.createDist(Install.java:44)
at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:107)
at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:63)
at ChildProcess.whenDone (myprodnode_modules\cordova-common\src\superspawn.js:135:23)
at ChildProcess.emit (events.js:210:5)
at ChildProcess.cp.emit (myprodnode_modules\cross-spawn\lib\enoent.js:34:29)
at maybeClose (internal/child_process.js:1021:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5) [ERROR] An error occurred while running subprocess cordova.
cordova.cmd build android --verbose exited with exit code 1.
Re-running this command with the --verbose flag may provide more information.
I tried to remove and add android remove node modules, I updated node module to latest version .
Can someone give me idea how to solved error.
Ivan, One thing seems typo, the command is ionic cordova build android, you have mentioned only cordova build android command, ionic is missing.
It seems your error is more related to Android Studio/Gradle installation not related to node module or ionic. still as per error mentioned which itself suggests please run build command with --verbose flag as below.
ionic cordova build android --verbose
the --verbose flag may help you to give exact Gradle or specific component associated error, which can further help you to reach to the specific root cause.
Please run ionic cordova build android instead of cordova build android to get APK and run ionic cordova build ios to get IPA
I'm facing some issue compiling an app in Cordova.
Basically after a Windows re-installation I re-istalled Android Studio, NPM and Cordova but when I try to run an application (I tried with the application I was working on before the OS re-installation and even with the "basic" Cordova app) Cordova give me "Exception in thread "main" java.lang.NullPointerException" (rest of the error below).
I've installed Gradle manually "C:\src\gradle-5.6" and set the environment variable (before Windows re-istallation I didn't installed it manually and it was working) and tried even to download and configure via env. varible the same version on the
\platforms\android\cordova\lib\builders\ProjectBuilder.js file, which is 4.10.3 but still the same error.
Checking Java JDK and Android SDK versions
ANDROID_SDK_ROOT=C:\Users\william.manzato\AppData\Local\Android\Sdk\
(recommended setting)
ANDROID_HOME=C:\Users\william.manzato\AppData\Local\Android\Sdk\
(DEPRECATED) Subproject Path: CordovaLib Subproject Path: app
Exception in thread "main" java.lang.NullPointerException
at org.gradle.wrapper.PathAssembler.getDistName(PathAssembler.java:84)
at org.gradle.wrapper.PathAssembler.getDistribution(PathAssembler.java:40)
at org.gradle.wrapper.Install.createDist(Install.java:44)
at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:107)
at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:61)
C:\Users\william.manzato\Wamp\NCR Error Codes
Translator\platforms\android\gradlew: Command failed with exit code 1
Error output: Exception in thread "main"
java.lang.NullPointerException
at org.gradle.wrapper.PathAssembler.getDistName(PathAssembler.java:84)
at org.gradle.wrapper.PathAssembler.getDistribution(PathAssembler.java:40)
at org.gradle.wrapper.Install.createDist(Install.java:44)
at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:107)
at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:61)
Did anyone else faced this issue and managed to solve it?
I reply by myself to this in case someone faces the same issue.
I just downgrade java (JRE and JDK) from 221 to 212, rebooted the pc et voilá, it works again.
On fresh React-Native project, i would like run default app on Android device, but i've this Java Exception :
WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html
WARNING: The specified Android SDK Build Tools version (26.0.1) is ignored, as it is below the minimum supported version (27.0.3) for Android Gradle Plugin 3.1.4.
Android SDK Build Tools 27.0.3 will be used.
To suppress this warning, remove "buildToolsVersion '26.0.1'" from your build.gradle file, as each version of the Android Gradle Plugin now has a default version of the build tools.
Exception in thread "DisconnectableInputStream source reader" org.gradle.api.UncheckedIOException: java.io.IOException: Resource temporarily unavailable
at org.gradle.internal.UncheckedException.throwAsUncheckedException(UncheckedException.java:57)
at org.gradle.internal.UncheckedException.throwAsUncheckedException(UncheckedException.java:40)
at org.gradle.util.DisconnectableInputStream$1.run(DisconnectableInputStream.java:125)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.io.IOException: Resource temporarily unavailable
at java.io.FileInputStream.readBytes(Native Method)
at java.io.FileInputStream.read(FileInputStream.java:255)
at java.io.BufferedInputStream.fill(BufferedInputStream.java:246)
at java.io.BufferedInputStream.read1(BufferedInputStream.java:286)
at java.io.BufferedInputStream.read(BufferedInputStream.java:345)
at org.gradle.util.DisconnectableInputStream$1.run(DisconnectableInputStream.java:96)
... 1 more
The app has been run on device, but with Error 500 on Metro Bundler.
Anyone can help me about this exception ? I'm on Linux environment.
Thank you community !
You need to create a bundle for your app.
mkdir android/app/src/main/assets
react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res
Then you could run it on your android.
Hope this helps.
By me this error comes up, because i had a bad file in the .idea folder.
found it as i tried to start the deployment server with
npm start
may this helps
I have installed java JRE but i keep on getting. Am using windows 10 for development
After running ionic run android or ionic emulate android i get this error:
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.<init>(ZipFile.java:215)
at java.util.zip.ZipFile.<init>(ZipFile.java:145)
at java.util.zip.ZipFile.<init>(ZipFile.java:159)
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
I have also set JRE_HOME in the environment variables
Probably it is related to something missing or corrupted.
You can find a similar question here, hope it helps.
First of all you have to install
node.js
apache ANT
JDK & JRE
Android SDK & Eclipse
After installation, you have to set software paths into environmental- variable. Then fire your npm install -g cordova. Without this PhoneGap will not be created.
I'm having an issue that's taking me since yesterday morning to figure it out with no success. I'm really desperate right now to solve this.
In the log console, at the bottom of the Android-Studio window I get this error:
Error: Gradle: Execution failed for task':MyApplication2:mergeDebugResources'.
>java.io.IOException: Cannot run program "/home/user/.local/android-studio/sdk/build-tools/android-4.2.2/aapt": error=2, No such file or directory
But happens that the file is there. I've done some research with no success. I'm taking so much time on this. I don't know why this should be wrong. I'm on Linux.
Please help me resolving this issue.
EDIT:
On Processing IDE the exact same error happens:
BUILD FAILED
/home/user/adt-bundle-linux-x86_64-20130729/sdk/tools/ant/build.xml:649: The following error occurred while executing this line:
/home/user/adt-bundle-linux-x86_64-20130729/sdk/tools/ant/build.xml:690: Execute failed: java.io.IOException: Cannot run program "/home/user/adt-bundle-linux-x86_64-20130729/sdk/build-tools/18.0.1/aapt" (in directory "/tmp/android8933435574063638939sketch"): java.io.IOException: error=2, No such file or directory
Try to install the following:
sudo apt-get --no-install-recommends install ia32-libs-multiarch