问题背景:虚拟机(7.0)和三星平板(4.4)可以正常安装,真机(9.0)不能安装
问题机型:华为 mate 10 pro
系统版本:9.0
开发环境:win7
查到了很多解决方案:
挨个试:
- clean、rebuild、重启
之前碰见这样的就是这么处理的,然而这次没什么卵用 - 包名首字母大写了
参考链接:https://stackoverflow.com/questions/37066617/failure-install-parse-failed-manifest-malformed
检查完发现没有,排除(检查清单文件就可以) - 包名不正确
检查后发现:清单文件的包名和gradle中的不一致
之前修改过包名,但是低版本手机上没有报错
以后切记修改包名一定要检查所有地方 - 清单文件配置错误
某次导入一个第三方库的时候,在application节点下增加了两条属性:
android:appComponentFactory="1231321"
tools:replace="android:appComponentFactory"
如果设置:android:appComponentFactory="",低版本不会报错,高版本报错,必须设置一个值,任意字符都可以,就是不能为空。
问题总结:
实际是两个问题导致的这个问题,一是包名不一致,二是application下新增的属性没有适配9.0
-
第一个问题是因为改包名没有细致检查(别手欠改包名,要改就单拉出一个分支,改完认真检查)
-
第二个问题是因为不了解这两个属性干啥用,当时按照studio的提示加上了,事后没有查相关的资料,这回长记性了
查了一下发现:没有介绍是干什么用的,都说为了解决某个问题要加上,以后查到再补充
下面是一些问题截图,可以忽略
Installation failed with message INSTALL_PARSE_FAILED_MANIFEST_MALFORMED: Failed parse during installPackageLI: /data/app/vmdl1321316968.tmp/base.apk (at Binary XML file line #25): Empty class name in package com.xiaobing.inprovedemo.
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?
Installation failed with message INSTALL_FAILED_ABORTED: User rejected permissions.
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?
Installation failed with message INSTALL_FAILED_UPDATE_INCOMPATIBLE: Package com.xiaobing.inprovedemo signatures do not match previously installed version; ignoring!.
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?