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.