报错Installation failed with message Failed to finalize session : INSTALL_FAILED_DUPLICATE_PERMISSION

来源:互联网 发布:苏有朋斥周杰炒作知乎 编辑:程序博客网 时间:2024/05/29 19:02

遇到这个报错问题,其实是真的挺受用的!把外包项目拿到手之后,发现里面的签名文件是用的系统签名文件,然后就自己从新打包签名后,再次安装后,就出现了上述这个报错!
报错如下:

Installation failed with message Failed to finalize session : INSTALL_FAILED_DUPLICATE_PERMISSION: Package com.hexinglong.hexinglongapp attempting to redeclare permission com.tencent.qcloud.timchat.permission.MIPUSH_RECEIVE already owned by com.hexinglong.hexinglong_supplier.It is possible that this issue is resolved by uninstalling an existing version of the apk if it is present, and then re-installing.

然后找run窗口下的打印日志:

Unknown failure (Failure - not installed for 0)Error while Installing APK    安装失败的重复权限

瞬间就觉得懵逼了!
通过其仔细观察INSTALL_FAILED_DUPLICATE_PERMISSION,原来是由于权限重复,是由于在导入的moudlue中有个自定义的权限,其绑定的签名文件是系统签名文件,而我重新签名后,又想重新绑定这个自定义的权限,所有就发生了冲突:

解决方案如下:就把清单文件的自定义permission的name改掉成不一样即可
原来配置如下:

<permission android:name="com.android.gallery3d.permission.GALLERY_PROVIDER1"        android:protectionLevel="signatureOrSystem" /><uses-permission android:name="com.android.gallery3d.permission.GALLERY_PROVIDER1" />

修改后如下:

<permission android:name="com.android.gallery3d.permission.GALLERY_PROVIDER222"        android:protectionLevel="signatureOrSystem" /><uses-permission android:name="com.android.gallery3d.permission.GALLERY_PROVIDER222" />

以上!

0 2