com.android.ddmlib.InstallException: Failed to establish session react-native
I am trying to run react-native android app in my nexus5 emulator
adb devices
List of devices attached
emulator-5554 device
started packager react-native start
running app - react-native run-android
Installing APK 'app-debug.apk' on 'reactnative(AVD) - 6.0' Unable to install examples/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 com.android.builder.testing.ConnectedDevice.installPackages(ConnectedDevice.java:113)
at com.android.builder.testing.ConnectedDevice$installPackages$0.call(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:128)
at com.android.build.gradle.internal.tasks.InstallVariantTask.install(InstallVariantTask.groovy:119)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:75)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.doExecute(AnnotationProcessingTaskFactory.java:226)
For Mi devices
for those who suffer from this:
- enable developer mode - In your phone, go to Settings, About phone and click on MIUI version 7 times. You’ll see a pop up which says you are a developer now.
- Go back to Settings, Additional settings, Developer options and enable USB Debugging.
- Connect your phone to your PC/Mac and on the phone authorize your computer
- go back to Developer options, scroll down to find Turn on MIUI optimization and disable it. Your phone will be rebooted
- Try it now :)
Post from : github
Try : react-native run-android --deviceId YOUR_ID
.
adb is known to be flaky. Try:
- Restarting adb with
$ adb kill-server
- Restarting the emulator
- Using Genymotion instead of stock Google emulator.
For your AVD emulator settings, try to make sure the "Use Host GPU" setting is checked, and relaunch the emulator and try again.
In my case, I have to run this command in
/sdklocation/platform-tools/
adb kill-server
then run again and watch for install request on the phone.
hope this help some one
If you had already installed app on device go delete it. It's work for me
For those like me having this issue in the emulator, one more tip: try to free up the available storage space in the emulator. That worked for me.
So many test apps and previous developed apps installed XD
Even i had the same problem,but restarting the genymotion and running the "react-native run-android" again worked for me. Ensure genymotion is running before running the above command.
Probable Cause
I faced this issue recently , I had first developed an app called 'myApp' in CordovaJS where the app domain was com.myapp and had it installed (this was months before I got into react ). Then when I switched to react-native I did an app with a domain com.myapp and ran into the same problem you are in.
So I figured out that there was conflicts when it came to domain and source .
Solution :
Uninstall the app that has a similar domain as the one that you are installing eg com.example , then reboot your phone .
It worked for me , I hope it works for you too.
01 - Uninstall the app installed in device
03- then run
- adb kill-server
02 -Then run again
- react-native run-android
Comments
Post a Comment