解决React Native安装应用到真机(红米3S)报Execution failed for task ':app:installDebug'的错误

报错信息如下:

:app:installDebug

Installing APK 'app-debug.apk' on 'Redmi 3S - 6.0.1'
Unable to install D:\ReactNative-Workspace\FirstRNProject\android\app\build\outp
uts\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(Connected
Device.java:113)

........ 中间一大堆报错信息省略 .........

: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.InstallExc
eption: Failed to establish session

一直跳错误信息:

解决过程:手机型号(红米3S,系统MIUI 8);先检查了一下开发者选项,USB调试、未知源 都是开启的;

然后发现 “启用MIUI优化”这一项是开启的,把它关掉(设置----更多设置----开发者选项----启用MIUI优化 关闭)

解决React Native安装应用到真机(红米3S)报Execution failed for task ':app:installDebug'的错误_第1张图片
image.png

你可能感兴趣的:(解决React Native安装应用到真机(红米3S)报Execution failed for task ':app:installDebug'的错误)