title: Can I remove this permission? (It cause INSTALL_FAILED_DUPLICATE_PERMISSION in Android 5.0 device)
body: <p>My tester said that he couldn't install the app from Play Store to his Nexus 5 (Lollipop). He said he got this error</p>
  
  <pre><code>Unknown error code during application install “-505”
  </code></pre>
  
  <p>I took his phone and try to install the app via adb, I got this error</p>
  
  <pre><code>Failure [INSTALL_FAILED_DUPLICATE_PERMISSION 
          perm=com.example.gcm.permission.C2D_MESSAGE 
          pkg=com.mailchimp.alterego]
  </code></pre>
  
  <p>After some reading, I came across this writing from @Commonsware </p>
  
  <p><a href="http://commonsware.com/blog/2014/08/04/custom-permission-vulnerability-l-developer-preview.html" rel="nofollow noreferrer">http://commonsware.com/blog/2014/08/04/custom-permission-vulnerability-l-developer-preview.html</a></p>
  
  <p>It's clearly that both my app and Mailchimp app (which installed on my tester's phone) has duplicated permission, <strong>com.example.gcm.permission.C2D_MESSAGE</strong>. 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</p>
  
  <p><a href="https://developer.android.com/google/gcm/client.html" rel="nofollow noreferrer">https://developer.android.com/google/gcm/client.html</a></p>
  
  <p><img src="https://i.stack.imgur.com/0iyjF.png" alt="enter image description here"></p>
  
  <p>I guess, both I and Mailchimp developer follow the same tutorial, added same permission and now both our app has duplicate permission. </p>
  
  <p>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. </p>
  
  <p>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)</p>
  
  <p>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?</p>
  
  <p><strong>-- NOTE --</strong></p>
  
  <p>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.</p>
  
  <p><a href="https://stackoverflow.com/questions/27043933/install-failed-duplicate-permission-c2d-message">INSTALL_FAILED_DUPLICATE_PERMISSION... C2D_MESSAGE</a></p>
  
  <p><strong>-- EDIT 1 --</strong></p>
  
  <p>I went back to the tutorial, the tutorial was right, it was my wrong implementation </p>
  
  <p><img src="https://i.stack.imgur.com/vYnqS.png" alt="enter image description here"></p>
  
  <p>I (and Mailchimp developer) should add permission with the name of our <strong>app package + ".permission.C2D_MESSAGE"</strong> instead of just copy and paste com.example.gcm.permission.C2D_MESSAGE</p>
  
  <pre><code>&lt;permission android:name="com.mycompany.myappname.permission.C2D_MESSAGE" 
              android:protectionLevel="signature" /&gt;
  </code></pre>
  
  <p>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.</p>