[RN坑]com.android.ddmlib.InstallException: Failed to establish session以及白屏

问题

环境

windows + 小米3

问题

react-native run-android运行react-native helloworld的时候,跑到:app:installDebug后就报错了

Installing APK 'app-debug.apk' on 'MI 3W - 6.0.1' for app:debug
Unable to install D:\Documents\WebStorm\react-native\AwwsomeProject\android\app\build\outputs\apk\app-debug.apk
com.android.ddmlib.InstallException: Failed to establish session
at com.android.ddmlib.SplitApkInstaller.install(SplitApkInstaller.java:64)
at com.android.ddmlib.Device.installPackages(Device.java:904)
at com.android.builder.testing.ConnectedDevice.installPackages(ConnectedDevice.java:137)
at com.android.build.gradle.internal.tasks.InstallVariantTask.install(InstallVariantTask.java:134)
...
: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.InstallException: Failed to establish session

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 6 mins 22.498 secs
Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
https://facebook.github.io/react-native/docs/android-setup.html

balabala一大堆

解决办法

[开发者选项]中 关闭 [弃用MIUI优化],白屏的话它自动提示我开启[悬浮窗权限],然后摇一摇reload一下就好了

参考文档

你可能感兴趣的:([RN坑]com.android.ddmlib.InstallException: Failed to establish session以及白屏)