Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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)
like image 276
invariant Avatar asked Sep 15 '15 04:09

invariant


4 Answers

For Mi devices

for those who suffer from this, try what lironess mentions in a Github Comment

  1. 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.
  2. Go back to Settings, Additional settings, Developer options and enable USB Debugging.
  3. Connect your phone to your PC/Mac and on the phone authorize your computer
  4. go back to Developer options, scroll down to find Turn on MIUI optimization and disable it. Your phone will be rebooted
  5. Try it now :)
like image 68
shrestha rohit Avatar answered Nov 16 '22 23:11

shrestha rohit


Try : react-native run-android --deviceId YOUR_ID.

like image 43
Badis Merabet Avatar answered Nov 16 '22 22:11

Badis Merabet


adb is known to be flaky. Try:

  • Restarting adb with $ adb kill-server
  • Restarting the emulator
  • Using Genymotion instead of stock Google emulator.
like image 11
Martin Konicek Avatar answered Nov 16 '22 22:11

Martin Konicek


For your AVD emulator settings, try to make sure the "Use Host GPU" setting is checked, and relaunch the emulator and try again.

like image 7
Edward Tan Avatar answered Nov 16 '22 23:11

Edward Tan