依賴com.android.support:appcompat-v7:26.0.0-alpha1報Manifest merger failed


SDK換成API26時出現,錯誤如下 
Error:Execution failed for task ':baselibrary:processDebugAndroidTestManifest'.
> Manifest merger failed : Attribute meta-data#android.support.VERSION@value value=(26.0.1) from [com.android.support:support-v13:26.0.1] AndroidManifest.xml:28:13-35
is also present at [com.android.support:appcompat-v7:26.1.0] AndroidManifest.xml:28:13-35 value=(26.1.0).

Suggestion: add 'tools:replace="android:value"' to <meta-data> element at manifestMerger9186971896321870306.xml:26:9-28:38 to override.


網上大多數都是這種解決方法:

configurations.all {
    resolutionStrategy.eachDependency { details ->
        def requested = details.requested
        if (requested.group == 'com.android.support') {
            if (!requested.name.startsWith("multidex")) {
                details.useVersion '25.3.1'
            }
        }
    }
}
當然,可以用任何正在使用的版本替換版本。如果有多個Module,每個build.gradle裏面都要加。
項目內出現了不同的support或者其他庫也引用了多個版本,合併出現了merge 錯誤,在此強制使用相同的版本即可。記錄一下

引用:

http://stackoverflow.com/questions/42949974/android-support-repo-46-0-0-with-android-studio-2-3/42957234#42957234

http://stackoverflow.com/questions/42987363/java-lang-noclassdeffounderror-failed-resolution-of-landroid-support-v4-animat

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章