1,在项目工程的根目录下的build.gradle文件中的allprojects 节点下进行如下配置:
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
}
}
allprojects {
repositories {
google()
jcenter()
}
//配置整个项目所依赖的库,保持指定的版本,否则报错.
configurations.all {
resolutionStrategy.eachDependency { /*DependencyResolveDetails*/ details ->
def requested = details.requested
if (requested.group == 'com.android.support') {
if (!requested.name.startsWith("multidex")) {
details.useVersion '28.0.0'
}
}
}
}
}