Reprinted from: Http://www.jianshu.com/p/6588c69b42cfProblem Description:
After upgrading to the 2.3 version of Android studio, Xiaomi Mobile Miui cannot run the Android studio program directly by clicking on it, reporting the following error:
Installation failed with message failed to establish session.
It is possible the this issue are resolved by uninstalling an existing version of APK if it's present,and then re-install Ing.
method One: Set the option in Instant run in Android Studio to not select
- Locate the option in instant run according to the following path
File--> settings--> Build, execution,deployment--> Instant Run
- Remove the Select box for the Enable Instant Run to hot swap code/resource changes on deploy (default enabled).
Solution1.png
- Click Apply, save the settings will be OK.
At this time, you can run the program directly on the Xiaomi phone by clicking Run.
Method Two: Turn off MIUI optimization in the developer options of the phone
- Go to the phone developer mode, at the bottom there is a Enable MIUI optimization option, turn off this option will prompt to restart the phone, choose to shut down and restart the restart, run our program again, you can run on the phone.
As a result, the Instans run function, which is turned on by default after upgrade 2.3, can be resolved ~
Xiaomi phone can't run Android Studio program directly