1

沒有記錄我正在使用一臺計算機Android Studio 2.2.2Gradle 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] 

我已經檢查 thisthis或其他的問題,但沒有解決我的問題。如果有任何人可以幫我,請提前。

這是我的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' 
+1

入住這http://stackoverflow.com/questions/27043933/install-failed-duplicate-permission-c2d-message – Shailesh

回答

0

找到了解決這個問題:

gradle這個assemble -info給了我一個提示,即Manifests具有不同的SDK版本,不能是m erged。

我需要編輯我艙單及的build.gradle文件,一切再次合作。


要清楚你需要編輯uses-sdkAndroidManifest.xml中

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

android部分,特別是minSdkVersiontargetSdkVersion的build.gradle文件

android { 
    compileSdkVersion 17 
    buildToolsVersion "17.0.0" 

    defaultConfig { 
     minSdkVersion 14 
     targetSdkVersion 16 
    } 
} 
+0

我試試這個,但不工作。我的錯誤不是'SDK'錯誤。謝謝你的回答 – Ninja

2

我解決我的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" /> 

我不知道,但它爲我工作。

1

我遇到過這個問題,因爲舊的依賴庫參考項目級build.gradle

在我的情況是被火力地堡

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

我已經從火力地堡控制檯更新

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

而且我已經更新配置文件,問題已經解決。

也許它可以幫助你......