首页 > 代码库 > Android support 26.0.0-alpha1 产生的问题 (复制的)
Android support 26.0.0-alpha1 产生的问题 (复制的)
全盘复制自以下博客地址,感谢原博主!:http://blog.csdn.net/fff2666/article/details/68062717
针对以下两个错误
Java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/v4/animation/AnimatorCompatHelper
和
Manifest merger failed : Attribute meta-data#Android.support.VERSION@value value=http://www.mamicode.com/(25.3.0) from [com.android.support:support-v13:25.3.0] AndroidManifest.xml:27:9-31 is also present at [com.android.support:preference-v7:26.0.0-alpha1] AndroidManifest.xml:24:9-38 value=http://www.mamicode.com/(26.0.0-alpha1). Suggestion: add ‘tools:replace="android:value"‘ to element at AndroidManifest.xml:25:5-27:34 to override.
都是因为如果程序内出现不同的,support或者其他外部引用库的多个版本,Gradle在进行合并的时候会使用本地持有的,最高版本的来进行编译,所以25的support就有可能引用26的东西,就会出现 属性 merge 错误 ,或者Class丢失,解决方法就是强制使用相同版本的库:
configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
def requested = details.requested
if (requested.group == ‘com.android.support‘) {
if (!requested.name.startsWith("multidex")) {
details.useVersion ‘25.3.0‘
}
}
}
}
引用:
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
Android support 26.0.0-alpha1 产生的问题 (复制的)