关键[许可#$ {}的applicationID .permission.C2D_MESSAGE]
没有记录我正在使用一台计算机Android Studio 2.2.2
和Gradle version is 2.14.1
。我的项目运行良好。当我尝试在其他电脑上打开同一个项目那么它给我下面的错误:
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]
我已经检查 this和this或其他的问题,但没有解决我的问题。如果有任何人可以帮我,请提前。
这是我的AndroidManifest.xml文件
<?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文件
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'
找到了解决这个问题:
gradle这个assemble -info给了我一个提示,即Manifests具有不同的SDK版本,不能是m erged。
我需要编辑我舱单及的build.gradle文件,一切再次合作。
要清楚你需要编辑uses-sdk
在AndroidManifest.xml中
<uses-sdk android:minSdkVersion="14" android:targetSdkVersion="16" />
和android
部分,特别是minSdkVersion
和targetSdkVersion
在的build.gradle文件
android {
compileSdkVersion 17
buildToolsVersion "17.0.0"
defaultConfig {
minSdkVersion 14
targetSdkVersion 16
}
}
我试试这个,但不工作。我的错误不是'SDK'错误。谢谢你的回答 – Ninja
我解决我的p由@shailesh提供的this question's answer。
我改这在我AndroidManifest.xml中文件
<!-- 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" />
我不知道,但它为我工作。
我遇到过这个问题,因为旧的依赖库参考项目级build.gradle
。
在我的情况是被火力地堡
classpath 'com.google.gms:google-services:3.0.0'
我已经从火力地堡控制台更新
classpath 'com.google.gms:google-services:3.1.0'
而且我已经更新配置文件,问题已经解决。
也许它可以帮助你......
入住这http://stackoverflow.com/questions/27043933/install-failed-duplicate-permission-c2d-message – Shailesh