Android Studio Gradle project Sync Failed solution

1. Check whether the gradle used by the project is consistent with the local gradle.

The local gradle general directory is under the C:\Users\admin\.gradle folder.

The gradle used by the project is in the project's gradle-wrapper.properties file.

distributionUrl=https\://services.gradle.org/distributions/gradle-4.4.1-all.zip   //网络下载
#distributionUrl=file:///C:/soft/it/android/AS/gradle/gradle-4.4.1-all.zip   //使用本地gradle

First unify the gradle used locally and the gradle version in the project.

If the network is good, delete the local .gradle folder directly and then resynchronize gradle.

If the network is not good, you can copy your colleague's .gradle folder, and then use the local gradle through settings. Or circumvent the wall and continue trying to download from the Internet.

2.ctrl + shift + alt + s to open the project settings and check whether the existing configuration is correct (it may point to an unavailable version).

 

3. If the first two steps cannot solve the problem:

Click Show Log in Explorer to view the error log. After opening the file, scroll to the bottom and you can see the general error message. Just resynchronize after it's resolved. For example, I encountered a gradle synchronization failure caused by not downloading Android sdk 29. I opened the sdk manager and downloaded sdk 29 before running it.

Guess you like

Origin blog.csdn.net/health7788/article/details/123222477