Method One: Download dependent jar package to solve the problem
official google-dependent manner:
buildscript {
repositories {
mavenCentral()
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
}
}
allprojects {
repositories {
mavenCentral()
jcenter()
google()
}
}
mavenCentral Mirror warehouse address
http://maven.aliyun.com/nexus/content/groups/public/
jentral Mirror warehouse address
http://maven.aliyun.com/nexus/content/repositories/jcenter
google image warehouse address
http://maven.aliyun.com/nexus/content/repositories/google
Replace official google rely Ali cloud images with warehouse
buildscript {
repositories {
// mavenCentral()
// jcenter()
// google()
maven { url 'http://maven.aliyun.com/nexus/content/repositories/google' }
maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' }
maven { url 'http://maven.aliyun.com/nexus/content/repositories/jcenter'}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
}
allprojects {
repositories {
// mavenCentral()
// jcenter()
// google()
maven { url 'https://plugins.gradle.org/m2/' }
maven { url 'http://maven.aliyun.com/nexus/content/repositories/google' }
maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' }
maven { url 'http://maven.aliyun.com/nexus/content/repositories/jcenter'}
}
}
Method Two: New Project to solve the problem of slow download gradle
First download the required version of Gradle Gradle Download , this time I updated the version 2.3 as, in gradle-3.3-all.zip files downloaded figure.
Open android studio project directory: <project directory> \ gradle \ wrapper \, edit wrapper directory gradle-wrapper.properties, a modified version of the last name of the file download behavior. As picture gradle-3.3-all.zip
Click Sync Project with Gradle Files icon on the toolbar android studio, and then close the android studio. The purpose of this step is to generate gradle directory, so the next step.
Open the c: \ user <user name> .gradle \ wrapper \ dists directory, this directory will have the third part of the operation we wrote in wrapper.properties version catalog generation, there is a string of numbers letters after entering the directory directory, enter the directory, delete all the files, the file you just downloaded gradle-3.3-all.zip direct access to the copy directory. As shown below
Finally, start the android studio, Sync Project with Gradle Files look is complete
references: