android调试出现无法安装问题:Installation failed with message null. It is possible that this issue is resolv...

【声明:】本文是作者(蘑菇v5)原创,版权归作者 蘑菇v5所有,侵权必究。本文首发在。如若转发,请注明作者和来源地址!未经授权,严禁私自转载!

问题描述:

一个测试项目,最近出了好多幺蛾子,碰到了各种各样的bug,可能因为项目换网络请求框架retrifit2、rxjava2和realm数据库的原因。经过不懈的努力,所有bug都修复了,可是安装到手机的时候,会报如下错误:

问题1

Installation failed with message null.It is possible that this issue is resolved by uninstalling an existing version of the apk if it is present, and then re-installing.

问题二

Installation failed with message INSTALL_CANCELED_BY_USER.
It is possible that this issue is resolved by uninstalling an existing version of the apk if it is present, and then re-installing.

android调试出现无法安装问题:Installation failed with message null. It is possible that this issue is resolv..._第1张图片
问题1
android调试出现无法安装问题:Installation failed with message null. It is possible that this issue is resolv..._第2张图片
问题2

解决问题思路方法:

当时自己首先尝试能不能签名后打包生成release的apk,发现是可以的。如下图所示:

android调试出现无法安装问题:Installation failed with message null. It is possible that this issue is resolv..._第3张图片
生成的apk

那项目中的代码,肯定是没有错误的了,因为能编译运行,还能签名打包生成apk。在懵逼的状态下,去google搜索了下错误信息,搜到如下结果:

android调试出现无法安装问题:Installation failed with message null. It is possible that this issue is resolv..._第4张图片
google搜索结果

发现第一篇是个提问题的文章,无解决方案,第二篇写了一堆东西,就是一个关键点,拖泥带水的描述,让在开发者选项最底部关闭MIUI优化那个选项,笔者小米4和华为荣耀7测试后,并没什么卵用。

下面介绍一下,笔者的解决办法,下面是干货了:

首先检查手机存储空间,如果不足,则无法安装。

华为荣耀7安装不上,是问题1的现象:

是因为无知的我,root手机时,安装了KingRoot,而它静默地把我的程序给禁止安装了。所以,有同样问题的朋友,可以去回想一下自己有没有root手机,看看是不是其他软件给禁止安装usb程序了。
笔者有图有真相,如下图:

android调试出现无法安装问题:Installation failed with message null. It is possible that this issue is resolv..._第5张图片
安装的KingRoot
android调试出现无法安装问题:Installation failed with message null. It is possible that this issue is resolv..._第6张图片
看它办的缺德事,害苦我了
小米4安装不上,是问题2的现象:

是因为MIUI升到8后出现的,MIUI上开发者选项必须勾选USB安装这一项,而不是启用MIUI优化那一项,这是笔者测试的结果。如下图配置:

android调试出现无法安装问题:Installation failed with message null. It is possible that this issue is resolv..._第7张图片
手机信息
android调试出现无法安装问题:Installation failed with message null. It is possible that this issue is resolv..._第8张图片
开发者选项配置一
android调试出现无法安装问题:Installation failed with message null. It is possible that this issue is resolv..._第9张图片
开发者选项配置二

结束语:

完美了,这样就两个手机都安装上测试程序了,就不上图了。如果还有问题,可以私聊笔者。
这还有别人的文章,笔者测试并没效果,你们还可以尝试下:

1.

http://stackoverflow.com/questions/32718044/android-studio-application-installation-failed

2.

http://stackoverflow.com/questions/40757663/i-getting-error-when-i-install-my-android-studio-project-in-device-redmi-3s-prim

3.

http://www.jianshu.com/p/e248f19963fe

4.

http://www.jianshu.com/p/fea7d9638535

你可能感兴趣的:(android调试出现无法安装问题:Installation failed with message null. It is possible that this issue is resolv...)