報錯資訊如下:
: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優化 關閉)

image.png