2017-07-30 56 views
3

Error:Execution failed for task ':app:processDebugManifest'. Manifest merger failed : Attribute meta-data#[email protected] value=(25.3.1) from [com.android.support:cardview-v7:25.3.1] AndroidManifest.xml:24:9-31 is also present at [com.android.support:appcompat-v7:26.0.0-alpha1] AndroidManifest.xml:27:9-38 value=(26.0.0-alpha1). Suggestion: add 'tools:replace="android:value"' to element at AndroidManifest.xml:22:5-24:34 to override.清單合併失敗 - 支持:程序兼容性-V7:26 +

我試圖讓一個應用程序與26 應用程序的目標SDK需要Facebook的SDK(最新根據4.25.0 Facebook SDK Versions

排球是版本1.0.0(Android Volley Dev Page

我只能從錯誤猜測,一些這些SDK的共享庫,但一個加載不同的版本到另一個...所以我需要添加某種形式的「加載這個,而不是這個」像我的Gradle文件中的命令?或者我只是缺少一些東西?

上面的錯誤發生在我下面顯示的G​​radle Build文件中。

項目建設搖籃:

// Top-level build file where you can add configuration options common to all sub-projects/modules. 

buildscript { 
    repositories { 
     jcenter() 
    } 
    dependencies { 
     classpath 'com.android.tools.build:gradle:2.3.3' 

     // NOTE: Do not place your application dependencies here; they belong 
     // in the individual module build.gradle files 
    } 
} 

allprojects { 
    repositories { 
     jcenter() 
     mavenCentral() 

    } 
} 

task clean(type: Delete) { 
    delete rootProject.buildDir 
} 

應用gradle這個編譯:

apply plugin: 'com.android.application' 

android { 
    compileSdkVersion 26 
    buildToolsVersion "26.0.1" 
    defaultConfig { 
     applicationId "com.example.johnny.fibre" 
     minSdkVersion 18 
     targetSdkVersion 26 

     versionCode 1 
     versionName "1.0" 
     testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 
    } 
    buildTypes { 
     release { 
      minifyEnabled false 
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
     } 
    } 
} 

dependencies { 

    compile fileTree(dir: 'libs', include: ['*.jar']) 
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { 
     exclude group: 'com.android.support', module: 'support-annotations' 
    }) 

    compile 'com.facebook.android:facebook-android-sdk:4.25.0' 
    compile 'com.android.support:appcompat-v7:26.+' 
    //compile "com.android.support:support-core-utils:25.+" 
    compile 'com.android.volley:volley:1.0.0' 
    //compile 'com.android.support:support-v4:26.0.0' 
    testCompile 'junit:junit:4.12' 
} 

我的AndroidManifest.xml

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

    <application 
     android:allowBackup="true" 
     android:icon="@mipmap/ic_launcher" 
     android:label="@string/app_name" 
     android:roundIcon="@mipmap/ic_launcher_round" 
     android:supportsRtl="true" 
     android:theme="@style/Theme.AppCompat.DayNight.NoActionBar"> 

     <uses-permission android:name="android.permission.INTERNET"/> 

     <activity android:name=".Home"> 
      <intent-filter> 
       <action android:name="android.intent.action.MAIN" /> 

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



     <meta-data android:name="com.facebook.sdk.ApplicationId" 
      android:value="@string/facebook_app_id"/> 

     <activity android:name="com.facebook.FacebookActivity" 
      android:configChanges= 
       "keyboard|keyboardHidden|screenLayout|screenSize|orientation" 
      android:label="@string/app_name" /> 
     <activity 
      android:name="com.facebook.CustomTabActivity" 
      android:exported="true"> 
      <intent-filter> 
       <action android:name="android.intent.action.VIEW" /> 
       <category android:name="android.intent.category.DEFAULT" /> 
       <category android:name="android.intent.category.BROWSABLE" /> 
       <data android:scheme="@string/fb_login_protocol_scheme" /> 
      </intent-filter> 
     </activity> 

    </application> 

</manifest> 

感謝您的幫助!我一直在評論和更改SDK版本和各種...

回答

3

facebook sdk在其依賴關係中使用'com.android.support:appcompat-v7:25.3.1''com.android.support:support-v4:25.3.1'

這時候,如果你exclude support-v4從Facebook的依賴來解決象下面這樣:

compile (‘com.facebook.android:facebook-android-sdk:4.25.0’){ 
    exclude group: 'com.android.support', module: 'support-annotations' 
} 

或從你的依賴compile 'com.android.support:appcompat-v7:26.+'排除。

+0

感謝您的幫助,我重新排序的依賴關係,並增加了幾個‘頂部新’的人,似乎已覆蓋問題。 – Jcov

5

我解決了這個問題進一步論壇瀏覽:

dependencies { 
    compile fileTree(dir: 'libs', include: ['*.jar']) 
    //androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { 
    // exclude group: 'com.android.support', module: 'support-annotations' 
    //}) 
    compile 'com.android.support:cardview-v7:26.0.0-alpha1' 
    compile 'com.android.support:customtabs:26.0.0-alpha1' 
    compile 'com.android.support:appcompat-v7:26.0.0-alpha1' 
    compile 'com.android.support.constraint:constraint-layout:1.0.2' 
    testCompile 'junit:junit:4.12' 
    compile 'com.facebook.android:facebook-android-sdk:[4,5)' 


} 

的依賴

com.android.support:cardview-v7:26.0.0-alpha1 
compile 'com.android.support:customtabs:26.0.0-alpha1' 

添加似乎解決問題。

1

排除被麻煩製造者庫的依賴:-)讓我們看一個例子:

implementation("com.jakewharton.rxbinding2:rxbinding:1.0.2") { 
    exclude group: 'com.android.support' 
} 

你可以更具體的添加要排除的模塊,以及:

exclude group: 'com.android.support', module: 'appcompat-v7' 
0

我已經解決了這個問題,在build.gradle中的app文件夾中更改了以下編譯文件。現在我正在使用這些編譯文件。

compile 'com.android.support:cardview-v7:26.+' 
compile 'com.android.support:customtabs:26.+' 
compile 'com.android.support:appcompat-v7:26.+' 
compile 'com.android.support.constraint:constraint-layout:1.0.2' 
compile 'com.android.support:recyclerview-v7:26.+' 

變化之前我使用這些文件

compile 'com.android.support:cardview-v7:26.0.0-alpha1' 
compile 'com.android.support:customtabs:26.0.0-alpha1' 
compile 'com.android.support:appcompat-v7:26.0.0-alpha1' 

只要改變編譯files.Use的版本 「26 +」,而不是「26.0。0-α1"

感謝