轉自 http://www.jianshu.com/p/6588c69b42cf ...
轉載自:http://www.jianshu.com/p/6588c69b42cf
Problem description:
Android Studio升級到2.3版本之後,小米手機MIUI不能直接點擊Run運行Android Studio程式,報如下錯誤:
方法一 :設置Android Studio 中Instant Run中的選項為不選中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.
- 根據以下路徑,找到Instant Run中的選項
File ——> Settings ——> Build, Execution,Deployment ——> Instant Run
- 將Enable Instant Run to hot swap code/resource changes on deploy(default enabled)的選擇框取消。
Solution1.png - 點擊Apply,保存設置就OK了。
這個時候就可以在小米手機上點擊Run直接運行程式了。
方法二:在手機的開發者選項中關閉MIUI優化
- 進入到手機的開發者模式,在最下麵有一個啟用MIUI優化選項,關閉這個選項會提示重啟手機,選擇關閉並重啟重新啟動後,再次運行我們的程式,就可以在手機上運行了。