Ninja
Ninja

Reputation: 698

No record for key [permission#${applicationId}.permission.C2D_MESSAGE]

I am using Android Studio 2.2.2 and Gradle version is 2.14.1.My project run fine in one computer. When i try to open same project in another computer then it send me below error:

Error:Execution failed for task ':app:processReleaseManifest'.
> No record for key [permission#${applicationId}.permission.C2D_MESSAGE]
Information:Gradle tasks [clean, :app:generateReleaseSources, :app:prepareReleaseUnitTestDependencies, :app:mockableAndroidJar]

I have checked this and this or other questions but not solved my issue. If any one can help me then please.Thanks in advance.

This is my AndroidManifest.xml file

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    package="com.newsongplay.app">

    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.WRITE_SETTINGS" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
    <uses-permission android:name="com.android.vending.BILLING" />

    <!-- GCM -->
    <uses-permission android:name="android.permission.WAKE_LOCK" />
    <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />

    <permission android:name="com.newsongplay.app.permission.C2D_MESSAGE"/>

    <uses-permission android:name="com.newsongplay.app.permission.C2D_MESSAGE" />

    <application
        android:name="com.newsongplay.app.activity.WaraMusicApplication"
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:supportsRtl="true"
        android:theme="@style/AppTheme"
        tools:replace="android:icon">
        <activity
            android:name="com.newsongplay.app.activity.SplashActivity"
            android:label="@string/app_name"
            android:screenOrientation="portrait"
            android:theme="@style/SplashTheme">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

        //Other activity also here

        <receiver
            android:name="com.google.android.gms.gcm.GcmReceiver"
            android:exported="true"
            android:permission="com.google.android.c2dm.permission.SEND">
            <intent-filter>
                <action android:name="com.google.android.c2dm.intent.RECEIVE" />
                <category android:name="com.google.android" />
            </intent-filter>
        </receiver>

        <service
            android:name=".gcm.PushNotificationService"
            android:exported="false">
            <intent-filter>
                <action android:name="com.google.android.c2dm.intent.RECEIVE" />
            </intent-filter>
        </service>

    </application>

</manifest>

This is my app level build.gradle file

apply plugin: 'com.android.application'

repositories {
    mavenCentral()
}

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.3"

    defaultConfig {
        applicationId "com.newsongplay.app"
        minSdkVersion 16
        targetSdkVersion 23
        versionCode 2
        versionName "1.0.1"
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.4.0'
    compile 'com.android.support:design:23.4.0'
    compile 'com.android.support:cardview-v7:23.4.0'
    compile 'com.squareup.okhttp3:okhttp:3.4.1'
    compile 'com.squareup.mimecraft:mimecraft:1.1.1'
    compile 'com.squareup.picasso:picasso:2.5.2'
    compile 'com.github.bumptech.glide:glide:3.7.0'
    compile files('libs/YouTubeAndroidPlayerApi.jar')
    compile 'com.malmstein:fenster:0.0.2'
    compile 'com.facebook.android:facebook-android-sdk:4.16.0'
    compile 'com.google.android.gms:play-services-auth:9.0.1'
    compile 'com.google.android.gms:play-services-plus:9.0.1'
    compile 'com.google.android.gms:play-services-gcm:9.0.1'
    compile 'org.apache.commons:commons-io:1.3.2'
}
apply plugin: 'com.google.gms.google-services'

Upvotes: 1

Views: 1775

Answers (3)

Vlad
Vlad

Reputation: 3571

I have met this issue due old dependency library reference project-level build.gradle.

In my case is was Firebase

classpath 'com.google.gms:google-services:3.0.0'

I have updated it to

classpath 'com.google.gms:google-services:3.1.0'

Also I have updated config file from Firebase console and problem has been solved.

Maybe it helps you...

Upvotes: 1

Ninja
Ninja

Reputation: 698

I solved my problem by this question's answer which is provided by @shailesh.

I changed to this in my AndroidManifest.xml file

<!-- GCM -->
    <uses-permission android:name="android.permission.WAKE_LOCK" />
    <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />

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

I don't know but it work for me.

Upvotes: 2

Abden Nacer
Abden Nacer

Reputation: 1

Found the solution to this problem:

gradle assemble -info gave me the hint that the Manifests have different SDK Versions and cannot be merged.

I needed to edit my Manifests and build.gradle file and everything worked again.


To be clear you need to edit the uses-sdk in the AndroidManifest.xml

<uses-sdk android:minSdkVersion="14" android:targetSdkVersion="16" />

and the android section, particularly minSdkVersion and targetSdkVersion in the build.gradle file

android {
    compileSdkVersion 17
    buildToolsVersion "17.0.0"

    defaultConfig {
        minSdkVersion 14
        targetSdkVersion 16
    }
}

Upvotes: 0

Related Questions