1.在您的应用程序的 build.gradle 添加以下内容:(任意位置,一般放在外层)
configurations.all {
resolutionStrategy.force'com.google.code.findbugs:jsr305:1.3.9'
}
强制Gradle只编译您为所有依赖关系声明的版本号,而不管依赖关系已声明的版本号。
2. 当编译版本出现不一致的时候,打包APK时候build会出现冲突,解决办法:
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'
}
}
}
}
3. 如果用使用其他Lib,要保证这些Lib没有被preDex,否则可能会抛出下面的异常