Android development error "Could not install Gradle distribution from: https://services.gradle.org....../gradle-7.0"

 When we import projects from github or gitee or create projects by ourselves, such errors will occur, as follows:

The main reasons for this are:

1. The network problem caused the gradle to not be downloaded completely. (Hotspots with limited traffic on mobile phones and networks that cannot access the external network (campus network)

2. The original .gradle does not match the .gradle of the existing project

The solution is as follows:

1. First import the project, gradle will be automatically downloaded, and your Gradle user home will be automatically changed to the gradle that matches the project, and it can be used after the download is complete.

2. If you have this gradle, the content in the gradle is complete, just refresh it (setting->Sync Project with Gradle Files) 

3. If you have multiple gradle-xxx-bin files in your .gradle file, you can set the path of the Gradle user home to a relative path (detailed explanation: every time Android creates a project, it will re-download the .gradle file_HaitangListen Feng 782's blog-CSDN blog ), let it load the files inside.

  4. If the .gradle download fails, you can also uninstall your original gradle first, and then click the above website to download again. 

 A complete Gradle file is as follows:

figure 1:

 figure 2:

 image 3:

Figure 4:

      Here, pay attention to the circled file in Figure 1. The file inside is the same as the file in the above picture, but if you don’t have this file, it will still give you an error:

 The wrapper file in Figure 1 is as follows:

 

Guess you like

Origin blog.csdn.net/qq_62079241/article/details/127200595