Android Studio create project to download gradle slow solution

Many solutions were found on the Internet about this problem, many of which were useless, but in the end they were resolved.

Modify build.gradle

Note: This method does not solve my problem.
One is about changing the source of the build.gradle file. This should be a solution to the slow sync problem of gradle . It is not the problem of downloading gradle when downloading the project , so it did not work. . But here are also ways to modify:

  • Make two changes in the project's build.gradle, plus domestic Alibaba Cloud
buildscript {
    
    
    repositories {
    
    
    	maven{
    
    url 'http://maven.aliyun.com/nexus/content/groups/public/'}
        google()
        jcenter()
    }
    dependencies {
    
    
        classpath "com.android.tools.build:gradle:4.0.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()
    }
}

Is in two places plus the line maven{url 'http://maven.aliyun.com/nexus/content/groups/public/'}
on google () and jcenter () not to delete or read some blog comments are not resolved unanimously, at their discretion here

Modify gradle-wrapper.properties

Note: This method did not solve my problem. The
second solution I found was to modify gradle-wrapper.properties. Originally, I downloaded gradle from a foreign site and changed it to a domestic site. This method should be faster, but it is My actual test has no effect at all , completely! (Don’t know why...)

#Fri Aug 14 20:43:40 CST 2020
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://downloads.gradle-dn.com/distributions/gradle-6.1.1-all.zip

Modify the address in the last statement to downloads.gradle-dn.com

Go to the browser website to download the corresponding version of gradle and put it in the corresponding folder

This method is the last effective way to solve my problem

  1. Go to the folder in this path: C:\Users\Jinondo.gradle\wrapper\dists\, you can see a folder to Haha
    find the corresponding version and download it on the website, for example: https://downloads.gradle-dn. com/distributions/gradle-6.1.1-all.zip, this is downloaded from a domestic site, of course you can also replace downloads.gradle-dn.com with the original source site, namely: https://services. gradle.org/distributions/gradle-6.1.1-all.zip.
  2. After downloading, put it in this folder: the
    Insert picture description here
    corresponding path is probably: C:\Users\your user name\.gradle\wrapper\dists\gradle-6.1.1-all\3imyvenb724qye48jp5w94wo4, the following string of 3imyvenb724qye48jp5w94wo4 is you downloading gradle The target path folder at the time, you can make your own judgment. For example, the folder will be modified when you download gradle. If you look at the latest modification time, it means that this folder is correct.
  3. Then open AS again, it will recognize that gradle is downloaded and it will be automatically loaded

Note that you only need to put the compressed package in, the folder above the picture is automatically added when loading!
I have seen this method on other blogs, but the path where the compressed package is placed is ambiguous and the onz is not resolved at the beginning

Guess you like

Origin blog.csdn.net/weixin_44427114/article/details/108035144