首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >没有密钥[permission#${applicationId}.permission.C2D_MESSAGE]的记录

没有密钥[permission#${applicationId}.permission.C2D_MESSAGE]的记录
EN

Stack Overflow用户
提问于 2017-02-24 09:10:03
回答 3查看 1.6K关注 0票数 1

我正在使用Android Studio 2.2.2Gradle version is 2.14.1.My项目,在一台计算机上运行良好。当我试图在另一台计算机中打开同一个项目时,它会将我发送到以下错误:

代码语言:javascript
运行
复制
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]

我检查过或其他问题,但没有解决我的问题。如果有人能帮我,那就提前please.Thanks吧。

这是我的AndroidManifest.xml文件

代码语言:javascript
运行
复制
<?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>

这是我的应用程序级build.gradle文件。

代码语言:javascript
运行
复制
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'
EN

回答 3

Stack Overflow用户

发布于 2017-02-24 10:50:02

我用@shailesh提供的这个问题的答案解决了我的问题。

我在我的AndroidManifest.xml文件中更改了这个

代码语言:javascript
运行
复制
<!-- 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" />

我不知道但这对我有用。

票数 2
EN

Stack Overflow用户

发布于 2017-09-19 14:23:54

由于旧的依赖库参考项目级别的build.gradle,我遇到了这个问题。

在我的例子中是

代码语言:javascript
运行
复制
classpath 'com.google.gms:google-services:3.0.0'

我已经更新到

代码语言:javascript
运行
复制
classpath 'com.google.gms:google-services:3.1.0'

另外,我已经从Firebase控制台更新了配置文件,并解决了问题。

也许它能帮你..。

票数 1
EN

Stack Overflow用户

发布于 2017-02-24 09:13:49

找到了这个问题的解决方案:

gradle汇编语言-info给了我一个提示,即清单有不同的SDK版本,不能合并。

我需要编辑我的清单和build.gradle文件,然后一切都恢复正常。

为了清楚起见,您需要在AndroidManifest.xml中编辑uses-sdk

代码语言:javascript
运行
复制
<uses-sdk android:minSdkVersion="14" android:targetSdkVersion="16" />

android部分,特别是build.gradle文件中的minSdkVersiontargetSdkVersion部分。

代码语言:javascript
运行
复制
android {
    compileSdkVersion 17
    buildToolsVersion "17.0.0"

    defaultConfig {
        minSdkVersion 14
        targetSdkVersion 16
    }
}
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/42434705

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档