com.android.ddmlib.InstallException:无法建立会话react-native [英] com.android.ddmlib.InstallException: Failed to establish session react-native
本文介绍了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
- 启用开发人员模式-在您的手机中,依次转到设置",关于手机",然后单击MIUI版本7次.您会看到一个弹出窗口 说您现在是开发人员.
- 返回到设置,其他设置,开发人员选项和启用USB调试.
- 将手机连接到PC/Mac,并在手机上授权计算机
- 返回开发者选项,向下滚动以找到打开MIUI优化并禁用.您的手机将重新启动
- 立即尝试:)
- 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 :)
这篇关于com.android.ddmlib.InstallException:无法建立会话react-native的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文