INSTALL_FAILED_DUPLICATE_PERMISSION... C2D_MESSAGE

NullPointerException picture NullPointerException · Nov 20, 2014 · Viewed 118.4k times · Source

I am using Google notifications in my app, and until now I have done below in the manifest:

<!-- GCM -->
<uses-permission android:name="android.permission.GET_ACCOUNTS" /> <!-- GCM requires a Google account. -->
<uses-permission android:name="android.permission.WAKE_LOCK" /> <!-- Keeps the processor from sleeping when a message is received. --> 
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" /> <!-- This app has permission to register and receive data message. --> 

<!-- Creates a custom permission so only this app can receive its messages. NOTE: APP_PACKAGE.permission.C2D_MESSAGE -->   
<permission android:name="com.myapp.permission.C2D_MESSAGE" android:protectionLevel="signature" />
<uses-permission android:name="com.myapp.permission.C2D_MESSAGE" />    
<!-- END GCM -->

It worked perfectly until I updated my Nexus 7 to Android 5.0.
Now when I try to install the app in this device with Eclipse, I get this error:

INSTALL_FAILED_DUPLICATE_PERMISSION perm=com.myapp.permission.C2D_MESSAGE pkg=com.myapp

I don't understand what is wrong? It was working perfectly until Android 5.0.
I know that I am using C2D_MESSAGE in two lines, permission and uses-permission but I have copied that code from the original Google GCM guide, so it must be fine.

Answer

Pratik Butani picture Pratik Butani · Dec 13, 2014

I've found a solution that works for me.

In My Device (Nexus 7) Android 5.0. Lollipop I follow these steps.

After Uninstalling App You will find App Name under Apps List of the Downloaded tab.

  • Go to Settings
  • Apps
  • At the bottom of the list, you will find YourApp with a "NOT INSTALLED" Tag
  • Open
  • Click on OptionMenu and Select "Uninstall for all Users"

After these steps, I successfully install the new app and it's running well.