react-native :app:installDebug FAILED
Install APK debug to my device failed.
jianglinghuadeMacBook-Pro:hello jianglinghua$ react-native run-android
JS server already running.
Building and installing the app on the device (cd android && ./gradlew installDebug...
WARNING [Project: :app] Current NDK support is deprecated. Alternative will be provided in the future.
:app:preBuild UP-TO-DATE
......
:app:assembleDebug UP-TO-DATE
:app:installDebug
Installing APK 'app-debug.apk' on 'MI NOTE LTE - 6.0.1'
Unable to install /Users/jianglinghua/Desktop/hello/android/app/build/outputs/apk/app-debug.apk
com.android.ddmlib.InstallException: Failed to establish session
at com.android.ddmlib.Device.installPackages(Device.java:894)
........
at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:61)
:app:installDebug FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:installDebug'.
> com.android.builder.testing.api.DeviceException: com.android.ddmlib.InstallException: Failed to establish session
* 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: 13.945 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
I look at my devices
jianglinghuadeMacBook-Pro:hello jianglinghua$ adb devices
List of devices attached
98333978 device
Since you are using Mi phone which has MIUI
try this
go to Developer options, scroll down to find 'Turn on MIUI optimization' & disable it. Your Phone will be rebooted
check now
I got the same problem and did some research. This problem happens a lot on Chinese android phones.
It was solved by change the gradle version to 1.2.3 in file android/build.gradle line 8
classpath 'com.android.tools.build:gradle:1.2.3'
Go to android/build.grade, change classpath 'com.android.tools.build:gradle:2.2.3' to classpath 'com.android.tools.build:gradle:1.2.3'
Then, go to android/gradle/wrapper/gradle-wrapper.properties, change distributionURL to https://services.gradle.org/distributions/gradle-2.2-all.zip
Run again.
If none of the above solutions works then try the following steps to cold boot the emulator
open AVD manager -> Edit device -> Show Advanced Settings -> Boot option -> select Cold Boot instead of Quick boot.
I couldn't get it to work with a hardware device. I kept getting the same error, but...
For your emulator you have to choose the IntelX86 Atom System image. Then ADB will connect to your emulator and it will properly install the installDebug.apk.
This is what I had to do.
Also look at this tutorial. It helped me immensely.
https://www.youtube.com/watch?v=cnqyUnASuk8
I had the same issue with wrong AVD settings. Probably, "Target Android 6.0" was wrong choice.
Next settings were changed to fix ":app:installDebug FAILED" issue: System Image: Marshmallow , API 23, ABI x86, Target Google API.
see the detail information about this here: RN Android Setup
I got the same issue, restarting emulator solved it. This happens as device appears to be offline.
I had this problem and I removed the apk file from my android device/emulator and then run react-native run-android and run successfuly .
I also got troubles with app using gradle 2.14, though with gradle 4 it's ok. By using --deviceID flag app instals without any issue.
react-native run-android --deviceId=mydeviceid
Install APK debug from cmd your emülator has been opened and try again its done.
Comments
Post a Comment