一、改进工程下的build.gradle
原文如下:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.0'
}
}
allprojects {
repositories {
jcenter()
}
}
改为下面:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
另外注意编译的版本号,默认即可
distributionUrl=File:///D:/gradle/gradle-5.0-milestone-1-all.zip
另外gradle-wrapper.properties中的gradle也最好更亲成最新的版本
distributionUrl=file:///D:/gradle/gradle-5.0-milestone-1-all.zip