小米手机无法调试应用解决Installation failed with message Failed to establish session.

时间:2024-03-14 09:40:10

小米手机性价比高,有些问题也很尖锐:

比如我的5S用了黑科技(试验品)-超声波指纹解锁,识别率就很低,每次解锁都要哈口气。真后悔

而且最近又遇到新问题,我的小米5S无法通过android studio调试应用,卖批啊(但即使这样也比蓝绿工程的OV手机强百倍)


不扯了,直接解决:


有人提出关闭MIUI优化,参考http://blog.csdn.net/u013132758/article/details/53835992

楼主试过,关闭是可行的,但是遇到一个更加无法忍受的问题,关闭小米手机MIUI优化,手机卡出翔,很不流畅。


于是有了今天这篇:


问题:

小米手机无法调试应用解决Installation failed with message Failed to establish session.小米手机无法调试应用解决Installation failed with message Failed to establish session.

AS提示:Installation failed with message Failed to establish session.
It is possible that this issue is resolved by uninstalling an existing version of the apk if it is present, and then re-installing.
WARNING: Uninstalling will remove the application data!
Do you want to uninstall the existing application?

原因:

原因很简单:我们使用了com.android.tools.build:gradle:2.3.0,就是android 插件版本的原因,小米部分手机出问题



解决:

知道原因了,解决很简单:只要在build.gradle文件里,降低android插件版本就行,例如降为 2.2.3。如下


小米手机无法调试应用解决Installation failed with message Failed to establish session.小米手机无法调试应用解决Installation failed with message Failed to establish session.



另外,我的gradle-wrapper是用的3.3版本,如图:

小米手机无法调试应用解决Installation failed with message Failed to establish session.