Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Could not install the app on the device, read the error above for details. #8868

Closed
jaxlifu opened this issue Jul 18, 2016 · 47 comments
Closed
Labels
Resolution: Locked This issue was locked by the bot.

Comments

@jaxlifu
Copy link

jaxlifu commented Jul 18, 2016

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

@cyprusglobe
Copy link

cyprusglobe commented Jul 18, 2016

@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.

@jaxlifu
Copy link
Author

jaxlifu commented Jul 19, 2016

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

@jaxlifu jaxlifu closed this as completed Jul 19, 2016
@ghost
Copy link

ghost commented Aug 30, 2016

@cyprusglobe Your suggestion worked. Thanks a lot.

@rocwong-cn
Copy link

It works for me too !! Thx!!! @cyprusglobe

@scheriff
Copy link

@cyprusglobe should this be put in documentation?

@uragecz
Copy link

uragecz commented Jan 2, 2017

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

@nysin
Copy link

nysin commented Feb 10, 2017

@cyprusglobe thanks your advice.it's useful

@liyanxi
Copy link

liyanxi commented Feb 24, 2017

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

@ashokseervidev
Copy link

how about windows i am getting the same error?

@ignacy130
Copy link

Had similar problem, but with
NoClassDefFoundError. Uninstalling java and jdk, rebooting and installing java and jdk (x86 and x64) helped me.

@Pianist038801
Copy link

Thanks, it worked!

@hanweixing
Copy link

@cyprusglobe it works for me too, thanks

@leon2017
Copy link

leon2017 commented May 3, 2017

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

@sukeyang
Copy link

Thanks, it worked! good !

@eaintphyo
Copy link

I got the same error on windows. Could you give me some solutions?

@coderabsolute
Copy link

coderabsolute commented May 18, 2017

Just starting out by downloading the latest react-native-cli. I do have the Android Emulator running in the background. Am running into similar issue and am not sure how to @cyprusglobe's solution....

@eaintphyo
Copy link

eaintphyo commented May 23, 2017

I also try like this as you commented, but the error has not gone. I want to run with external device.
Thanks @coderabsolute

@eaintphyo
Copy link

I finally figured out the problem and solved it.

@anndyang2017
Copy link

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

@anndyang2017
Copy link

@eaintphyo ,can you share the experience! thanks!

@fulushan
Copy link

@cyprusglobe thanks!

@muhtar-sgk
Copy link

@cyprusglobe you're clever
thx man

@mmahandev
Copy link

@cryptobiote Thanks for this.

Windows users will want to run chmod 755 android/gradlew.bat

@muhtar93
Copy link

Yes, i know
But i'm mac users :)

@codelinter
Copy link

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

@WeslleyNasRocha
Copy link

It worked for me 👍

@kostyaVyrodov
Copy link

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

@sheyda93
Copy link

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.(ZipFile.java:219)
at java.util.zip.ZipFile.(ZipFile.java:149)
at java.util.zip.ZipFile.(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

@kostyaVyrodov
Copy link

kostyaVyrodov commented Aug 29, 2017

@sheyda93
I sometimes still run into the error, and you can try to perform next steps:

  1. Go to android-sdk\platform-tools\adb.exe and run via cmd: adb.exe devices
    You should make sure that device is really visible
  2. Remove all files from the dir: "yourproject"....../android/app/build
    (the build dir should be empty)
  3. Uninstall app from emulator (if you have already installed it)

Try to install again

@marceloaraujo
Copy link

@cyprusglobe Man, you saved my life. Thanks a lot!!!

@enzeberg
Copy link

enzeberg commented Oct 3, 2017

For Windows:
@kostyaVyrodov is right. Running "react-native run-android" via cmd as admin helps. Use cmd as admin, but not PowerShell.

@labidiaymen
Copy link

@enzeberg Running "react-native run-android" via cmd as admin helps me also.

@ngoctuong96
Copy link

ngoctuong96 commented Oct 24, 2017

@cyprusglobe how to check permission on android/gradlew?

@TheHemantKaushik
Copy link

I'm running command as:

sudo react-native run-android

@shenghaoAN
Copy link

It works for me.

@joelGarcia93
Copy link

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

@TheHemantKaushik
Copy link

TheHemantKaushik commented Dec 27, 2017

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

@marcelloJr
Copy link

marcelloJr commented Dec 30, 2017

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...

@guguji5
Copy link

guguji5 commented Apr 3, 2018

"chmod -R 777 android/grandlew" doesn't work in my mac

@AnandanRajkumar
Copy link

Starting JS server...
Building and installing the app on the device (cd android && gradlew.bat install
Debug)...
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/getting-started.html

List of devices attached
C4F12440556EC9E device

if i try this chmod 755 android/gradlew

i am getting chmod not a internal and external commend
Note: i am using windows 8.1

this will happen after npm run eject

please any one help to solve this.

@boythan
Copy link

boythan commented Apr 24, 2018

@cyprusglobe you save of my day. tsk a lot

@kinotto
Copy link

kinotto commented Apr 25, 2018

uninstalling and reinstalling react-native globally worked for me on windows

@uguryiilmz
Copy link

Why there is still no solution for windows??

@akshayseth
Copy link

For me enabling developer options in emulator worked.I mean obviously you have to do that boi!

@fuchangge
Copy link

今天也遇到这个问题,刚解决,在项目下:
执行:chmod 755 android/gradlew =>没解决
执行: chmod 755 . =>已解决

niltonkummer pushed a commit to niltonkummer/rnbase that referenced this issue May 15, 2018
facebook/react-native#8868

Signed-off-by: Nilton Kummer <niltonkummer@gmail.com>
@VivekHA
Copy link

VivekHA commented May 15, 2018

Hello,
Im getting same error message.

C:\Projects\MobApp\Project1\sample1>react-native run-android
Scanning folders for symlinks in C:\Projects\MobApp\Project1\sample1\node_modules (249ms)
Starting JS server...
Building and installing the app on the device (cd android && gradlew.bat installDebug)...
Downloading https://services.gradle.org/distributions/gradle-2.14.1-all.zip

Exception in thread "main" java.net.UnknownHostException: services.gradle.org
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.SocksSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.connect(Unknown Source)
at com.sun.net.ssl.internal.ssl.BaseSSLSocketImpl.connect(Unknown Source)
at sun.net.NetworkClient.doConnect(Unknown Source)
at sun.net.www.http.HttpClient.openServer(Unknown Source)
at sun.net.www.http.HttpClient.openServer(Unknown Source)
at sun.net.www.protocol.https.HttpsClient.(Unknown Source)
at sun.net.www.protocol.https.HttpsClient.New(Unknown Source)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.getNewHttpClient(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect(Unknown Source)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(Unknown Source)
at org.gradle.wrapper.Download.downloadInternal(Download.java:58)
at org.gradle.wrapper.Download.download(Download.java:44)
at org.gradle.wrapper.Install$1.call(Install.java:59)
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/getting-started.html

Where do i run this commend ? chmod 755 android/gradlew
if i run this in terminal i get this error message : 'chmod' is not recognized as an internal or external command,
operable program or batch file.

@facebook facebook locked as resolved and limited conversation to collaborators May 24, 2018
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Jul 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests