Execution failed for task ':app:installDebug'. > com.android.builder.testing.api.DeviceException: com.android.ddmlib.InstallException: Failed to establish session

0.12字数 121阅读 1060

小米手机在使用React Native的时候会遇到如题的错误,我在论坛找到了答案,如下:
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
go back to Developer options, scroll down to find Turn on MIUI optimization and disable it. Your phone will be rebooted
Try it now :)