This problem stuck me for three days
My head hurts!
final solution
Create a new project and change two files
Change it to this in build.gradle:
buildscript {
repositories {
maven {
url "http://maven.aliyun.com/nexus/content/groups/public/"
}
google()
jcenter()
}
dependencies {
classpath "com.android.tools.build:gradle:4.1.1"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
maven {
url "http://maven.aliyun.com/nexus/content/groups/public/"
}
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
For the gradle version, I choose 4.1.1. The gradle versions in the upper and lower files should be unified.
Change gradle-wrapper.properties like this
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1.1-all.zip
After downloading and loading in three minutes without reporting an error, Alibaba Cloud is awesome! ! ! ! !
In the future, I will solve all bugs and problems related to Marven and Gradle through aliyun mirroring!