Help us understand the problem. What is going on with this article?

Android5.0で`Failure [INSTALL_FAILED_DUPLICATE_PERMISSION perm=com.app.name.permission.C2D_MESSAGE pkg=com.app.name]`と表示されたときの対応

More than 5 years have passed since last update.

しょうもないところでハマったのでメモ。

http://stackoverflow.com/questions/27154990/android-l-permission-conflict-between-release-and-debug-apks

Android5.0にしてから開発版と製品版が同居できなくなった!と思ったら↑が原因だと思います。

対応

Manifestファイルに書いてるパッケージ名が重複していることが原因なので、${applicationId}に置き換えてやれば大丈夫って話です。

こんな感じ

AndroidManifest.xml
<receiver
    android:name=".gcm.GcmBroadcastReceiver"
    android:permission="com.google.android.c2dm.permission.SEND">
        <intent-filter>
            <action android:name="com.google.android.c2dm.intent.RECEIVE"/>
            <category android:name="${applicationId}"/>
        </intent-filter>
</receiver>

<permission
    android:name="${applicationId}.permission.C2D_MESSAGE"
    android:protectionLevel="signature"/>
<uses-permission android:name="${applicationId}.permission.C2D_MESSAGE"/>
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away