依赖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 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

你可能感兴趣的:(Bug笔记)