添加编译RecyclerView后,Gradle Manifest Merger失败

时间:2017-06-02 11:38:12

标签: android android-gradle android-manifest

能够导入RecyclerView后会弹出此错误消息。我找不到来源或修复。错误消息似乎也很难遵循。

  

错误:任务':app:processDebugManifest'的执行失败。   清单合并失败:来自[com.android.support:appcompat-v7:25.3.1]的属性meta-data#android.support.VERSION@value value =(25.3.1)AndroidManifest.xml:27:9-31       也出现在[com.android.support:recyclerview-v7:26.0.0-alpha1] AndroidManifest.xml:24:9-38 value =(26.0.0-alpha1)。       建议:在AndroidManifest.xml:25:5-27:34中添加'tools:replace =“android:value”'以覆盖。

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

    <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/AppTheme">
        <activity android:name=".ui.ListActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

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

</manifest>

build.gradle(module:app)

    apply plugin: 'com.android.application'

android {
    compileSdkVersion 25
    buildToolsVersion "25.0.3"
    defaultConfig {
        applicationId "com.example.me.listviewprojektfuerapp"
        minSdkVersion 16
        targetSdkVersion 25
        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(include: ['*.jar'], dir: 'libs')
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'com.android.support:appcompat-v7:25.3.1'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:recyclerview-v7:26.0.0-alpha1'
}

3 个答案:

答案 0 :(得分:1)

您需要使用此版本的recyclerView进行编译 compile 'com.android.support:recyclerview-v7:25.3.1'

答案 1 :(得分:1)

您正在使用com.android.support:appcompat-v7:25.3.1以及com.android.support:recyclerview-v7:26.0.0-alpha1,recycler视图是appcompact库的一部分,因此冲突和也建议使用相同的库版本

以获取更多参考资料 - https://developer.android.com/topic/libraries/support-library/features.html

答案 2 :(得分:0)

工具:replace =“android:value”&lt; ====将它放在您的应用程序属性中,或者您可以将两个库的两个版本设置为相同的版本。

相关问题