我可以删除此权限吗? (它会在Android 5.0设备中导致INSTALL_FAILED_DUPLICATE_PERMISSION) [英] Can I remove this permission? (It cause INSTALL_FAILED_DUPLICATE_PERMISSION in Android 5.0 device)

查看:448
本文介绍了我可以删除此权限吗? (它会在Android 5.0设备中导致INSTALL_FAILED_DUPLICATE_PERMISSION)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的测试人员说他无法从Play Store安装应用程序到他的Nexus 5(棒棒糖)。他说他得到这个错误在应用程序安装过程中出现未知的错误代码-505

  > 

我拿着他的手机,尝试通过adb安装应用程序,我得到了这个错误

 失败[INSTALL_FAILED_DUPLICATE_PERMISSION 
perm = com.example.gcm.permission.C2D_MESSAGE
pkg = com.mailchimp.alterego]

经过一番阅读,我从@Commonsware中看到这篇文章



- 编辑1 -



我回到教程,教程是正确的,这是我的错误实现

)应使用我们的应用包+.permission.C2D_MESSAGE的名称添加权限,而不是仅复制和粘贴com.example.gcm.permission.C2D_MESSAGE

 < permission android:name =com.mycompany.myappname.permission.C2D_MESSAGE
android:protectionLevel =signature/>

但是,这又向我提出了另一个问题,教程说如果我们不添加此权限或名称与模式不匹配,应用程序不会收到消息。但是,当我测试消息时,即使当我删除此许可证时,我也收到了消息......很奇怪。

解决方案

正如 INSTALL_FAILED_DUPLICATE_PERMISSION ... C2D_MESSAGE ,您应该使用 $ {applicationId} 代替AndroidManifest中的静态应用程序ID。


$ b 示例:

 < uses-permission android:name =$ {applicationId} .permission.C2D_MESSAGE/> 

它可以解决您的问题,如果您开始使用Flavor,那么所有功能都可以完美运行。 ;)

My tester said that he couldn't install the app from Play Store to his Nexus 5 (Lollipop). He said he got this error

Unknown error code during application install "-505"

I took his phone and try to install the app via adb, I got this error

Failure [INSTALL_FAILED_DUPLICATE_PERMISSION 
        perm=com.example.gcm.permission.C2D_MESSAGE 
        pkg=com.mailchimp.alterego]

After some reading, I came across this writing from @Commonsware

http://commonsware.com/blog/2014/08/04/custom-permission-vulnerability-l-developer-preview.html

It's clearly that both my app and Mailchimp app (which installed on my tester's phone) has duplicated permission, com.example.gcm.permission.C2D_MESSAGE. I then check my git log to see when did I add that line to my AndroidManifest and found that it was when I implement GCM. Back then, I followed this tutorial

https://developer.android.com/google/gcm/client.html

I guess, both I and Mailchimp developer follow the same tutorial, added same permission and now both our app has duplicate permission.

So, I remove that permission from my AndroidManifest and now I'm able to install my app on my tester's phone. I test the GCM message by sending to package to GCM server from my php script and app still got GCM message as it was.

So, will there be other issue raised because of that missing permission and what is the point of having that permission anyway? (since without it, my app still got GCM message)

My concern is, if our app is using a plugin/library that required permission. We won't be able to install our app on Lollipop device if there is another installed app which using the same library, isn't it?

-- NOTE --

I already read this question, few people suggest the same thing to what I did, remove permission. But no one talking about what will happen after we do it or why do we have to add it.

INSTALL_FAILED_DUPLICATE_PERMISSION... C2D_MESSAGE

-- EDIT 1 --

I went back to the tutorial, the tutorial was right, it was my wrong implementation

I (and Mailchimp developer) should add permission with the name of our app package + ".permission.C2D_MESSAGE" instead of just copy and paste com.example.gcm.permission.C2D_MESSAGE

<permission android:name="com.mycompany.myappname.permission.C2D_MESSAGE" 
            android:protectionLevel="signature" />

But, this raise another question to me, tutorial said that if we don't add this permission or the name doesn't match the pattern, app won't get the message.But I got the message when I test even when I remove this pemission... weird.

解决方案

As described in INSTALL_FAILED_DUPLICATE_PERMISSION... C2D_MESSAGE , you should use ${applicationId} instead a static application id in the AndroidManifest.

Example:

<uses-permission android:name="${applicationId}.permission.C2D_MESSAGE"/>

It will fix your problem and if you starting using Flavor everything will work perfectly too. ;)

这篇关于我可以删除此权限吗? (它会在Android 5.0设备中导致INSTALL_FAILED_DUPLICATE_PERMISSION)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆