com.android.ddmlib.InstallException:无法建立会话react-native [英] com.android.ddmlib.InstallException: Failed to establish session react-native

查看:74
本文介绍了com.android.ddmlib.InstallException:无法建立会话react-native的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在nexus5模拟器中运行react-native android应用

I am trying to run react-native android app in my nexus5 emulator

adb devices
List of devices attached
emulator-5554   device

启动打包程序react-native start

正在运行的应用-react-native run-android

在'reactnative(AVD)-6.0'上安装APK'app-debug.apk' 无法安装示例/android/app/build/outputs/apk/app-debug.apk

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)

推荐答案

对于 Mi设备

对于遭受此困扰的人,请尝试在 GitHub评论

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

  1. 启用开发人员模式-在您的手机中,依次转到设置",关于手机",然后单击MIUI版本7次.您会看到一个弹出窗口 说您现在是开发人员.
  2. 返回到设置其他设置开发人员选项启用USB调试.
  3. 手机连接到PC/Mac,并在手机上授权计算机
  4. 返回开发者选项,向下滚动以找到打开MIUI优化并禁用.您的手机将重新启动
  5. 立即尝试:)
  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 :)

这篇关于com.android.ddmlib.InstallException:无法建立会话react-native的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆