react-native: Could not install the app on the device, read the error above for details.

jax$  react-native run-android
Starting JS server...
Building and installing the app on the device (cd android && ./gradlew installDebug...

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

jax$ adb devices
List of devices attached
192.168.56.101:5555 device

how can I fix it , On my computer . It’s ok for react-native run-ios and it’s ok for react-native run-android on my company computer

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Reactions: 20
  • Comments: 47

Commits related to this issue

Most upvoted comments

@RainliFu you might check the permissions on android/gradlew

they should be 755 not 644

run chmod 755 android/gradlew inside your app root folder then run react-native run-android

and it should work again.

how about windows i am getting the same error?

I’m running command as:

sudo react-native run-android

@cyprusglobe should this be put in documentation?

Thanks, it worked! good !

Basta modificar a permissão (sudo chmod -R 777 android/grandlew) da pasta android/grandlew dentro da raiz do projeto, ou você pode rodar o comando sudo react-native run-android

I finally figured out the problem and solved it.

@cyprusglobe Thanks for your help. This pit is good!

I tried “sudo react-native run-android” on my mac, working fine!

I was facing same issue, I fixed by running “npm install” Lol

On windows, this can be resolved by reinstalling react-native-cli

npm uninstall -g react-native-cli

npm install -g react-native-cli

Restart powershell and Android Studio. You must start a new project and delete old ones.

react-native init NewProject

@eaintphyo ,can you share the experience! thanks!

@eaintphyo ,我想知道你是怎么解决的呀!?

if your android rom is MIUI ROM,find the solution: go settings -> developer option -> close MIUI optimization

Why there is still no solution for windows??

hi , when I wanna run project , I have this error , guide me plz: Scanning 556 folders for symlinks in C:\Users\sheyda\shidi\node_modules (63ms) Starting JS server… Building and installing the app on the device (cd android && gradlew.bat installDebug)…

Unzipping C:\Users\sheyda.gradle\wrapper\dists\gradle-2.14.1-all\8bnwg5hd3w55iofp58khbp6yv\gradle-2.14.1-all.zip to C:\Users\sheyda.gradle\wrapper\dists\gradle-2.14.1-all\8bnwg5hd3w55iofp58khbp6yv 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

It helped on windows: Run ‘react-native run-android’ via cmd as admin

@cyprusglobe thanks your advice.it’s useful

I have simillary issues but error message looks -```

 Unknown source file : UNEXPECTED TOP-LEVEL EXCEPTION:
Unknown source file : com.android.dex.DexException: Multiple dex files define La
ndroid/support/v7/appcompat/R$anim;
Unknown source file :   at com.android.dx.merge.DexMerger.readSortableTypes(DexM
erger.java:596)
Unknown source file :   at com.android.dx.merge.DexMerger.getSortedTypes(DexMerg
er.java:554)
Unknown source file :   at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerg
er.java:535)
Unknown source file :   at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.j
ava:171)
Unknown source file :   at com.android.dx.merge.DexMerger.merge(DexMerger.java:1
89)
Unknown source file :   at com.android.dx.command.dexer.Main.mergeLibraryDexBuff
ers(Main.java:502)
Unknown source file :   at com.android.dx.command.dexer.Main.runMonoDex(Main.jav
a:334)
Unknown source file :   at com.android.dx.command.dexer.Main.run(Main.java:277)
Unknown source file :   at com.android.dx.command.dexer.Main.main(Main.java:245)

Unknown source file :   at com.android.dx.command.Main.main(Main.java:106)

:app:dexDebug FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:dexDebug'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.E
xecException: Process 'command 'C:\Program Files\Java\jdk1.8.0_101\bin\java.exe'
' finished with non-zero exit value 2

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

BUILD FAILED

Total time: 22.166 secs
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

(node:6876) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejec
tion id: 2): TypeError: Cannot read property 'message' of undefined

@cyprusglobe Thanks for your help,I will try later! My company computer is ok .