Solve the problem of Gradle sync failed: Gradle Sync Issues (Android Development/Android Studio)

When I first learned mobile development, when I opened android studio, I would be prompted with the following question: Could not install Gradle distribution from ' https://services.gradle.org/distributions/gradle-7.3.3-bin.zip'.

I read many methods on the Internet, and it was said that I downloaded the relevant Gradle file and specified the relevant location . I tried many times, but it was unsuccessful. Later, I found out that there was a problem with the step of specifying the location .

It roughly summarizes how to solve the problem of Gradle sync failed (including downloading Gradle files and specifying relevant locations)

  1. First open android studio, open File---Settings---Gradle, check the location of Gradle Use Home, usually in C:\users\{user name}\.gradle\wrapper\dists , remember this location and find it .

  1. After finding the location, delete all the files in the dists directory . I only have one gradle-7.3.3-bin file here, so delete it.

  1. Then return to android studio, click File---Close Project in the upper left corner to close android studio, and the following figure will be displayed after closing

  1. 点击New Project新建项目,点Finish进入主界面(第4步的目的是为了得到AS自动创建的下载目录,这时候进入主界面还是显示异常:Could not install Gradle distribution from 'https://services.gradle.org/distributions/gradle-7.3.3-bin.zip'.,但是不用担心,接着下面的步骤来就要成功了)

  1. 本来已经删除dists下的文件了,这时你再打开会发现自动创建了新的文件,如下图。

但是系统自动创建的文件并不全,所以需要下载。此时点击主界面(图1)的蓝色链接,然后耐心等待(不成功的话多刷新几次),然后会弹出文件下载地址,我们安装到dists目录下,直接点击下载(下载过程可能比较慢)。如图2。

图1

图2

  1. 下载完成后,直接关闭android studio(右上角叉掉)。

  1. 此时再打开android studio会发现问题依然在,这也是之前卡住我很长时间的问题。再次关闭android studio。接下来的第8步是很重要的一步。

  1. 之前点击蓝色链接下载的文件默认放到了dists目录下(图3),此时需要将该文件(gradle-7.3.3-bin.zip)移动到bin文件里的乱码文件下(与.lck和.part文件同一目录)(图4),最终结果如图5

图3

图4

图5

  1. 打开android studio,发现问题解决。

Guess you like

Origin blog.csdn.net/m0_58655411/article/details/129417313