Android引入库后appcompat版本冲突


Android 引入库后appcompat版本冲突

Android工程在引入某个库之后会报下面的错误,版本混乱问题

All com.android.support libraries must use the exact same version specification (mixing versions can lead to runtime crashes). Found versions 27.1.1, 27.1.0, 27.0.1. Examples 
include com.android.support:animated-vector-drawable:27.1.1 and com.android.support:exifinterface:27.1.0 more... (Ctrl+F1)

There are some combinations of libraries, or tools and libraries, that are incompatible, or can lead to bugs. One such incompatibility is compiling with a version of the Android support libraries that is not the latest version (or in particular, a version lower than your targetSdkVersion).

你可以通过gradlew assembleDebug –info编译打印详细信息查看具体是哪个地方引起的,然后逐个解决,找最新的库,写exclude配置,或者自己编译,或者删除class文件重新打包,当然也有一劳永逸的办法,就是在项目的gradle文件下的allprojects里面配置如下规则,统一使用某个版本

subprojects {
    project.configurations.all {
        resolutionStrategy.eachDependency { details ->
            if (details.requested.group == 'com.android.support'
                    && !details.requested.name.contains('multidex') ) {
                details.useVersion "27.1.1"
            }
        }
    }
}

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://11000011.com/?id=27

« 上一篇 下一篇 »

我要评论

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。

主机推荐

  • 搬瓦工