Reprinted from: Solve the problem of Xiaomi phone can't run Android Studio program
Problem description
After upgrading to the 2.3 version of Android studio, Xiaomi Mobile MIUI8 cannot run the Android studio program, reporting the following error:
Installation failed with message Failed to establish session.It is possible that this issue is resolved by uninstalling an existing version of apk if it is present, and then re-installing
Workaround set the option in Instant run in Android Studio to not select
- Locate the option File--settings--build,execution,deployment--instant run in Instant run according to the following path
Remove the Select box for the Enable Instant Run to hot swap code/resource changes on deploy (default enabled).
Click Apply, save the settings will be OK. It's time to run the program on the Xiaomi phone.
Turn off MIUI optimization in the developer mode of your 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.
PS: The first method is to see a friend say in the water group, I tried to find the perfect solution to the problem, thanks to the friend's help. It also shows how important water is in the group, haha. In this way, hope to help the needy friends.
Fix problems with Xiaomi phone not running Android Studio program