Android Studio solves the Gradle sync failed process

Android Studio solves the Gradle sync failed process

Android Studio version 2022.1.1.20-windows version.
When creating a new project, I encountered the problem of Gradle sync failed; the methods I have tried are:
1. Delete the Gradle package and rebuild it.
2. Disable self-downloaded plug-ins.
None of them can solve the problem. Search the problem on stackoverflow, and the suggestion is to check the log file to find the real cause of the problem.

Screenshot of the problem

Click on the top of the editing area

Show Log in Explorer

Open the Log file in the file window, clear the Log to avoid increasing our search costs for historical logs, and restart Android Studio to get the log of this startup.
search keywords
Search for the keyword "error"
to get the following fields

INFO - #o.j.p.g.s.p.GradleProjectResolver - Gradle project resolve
error org.gradle.tooling.BuildException: Could not run phased build
action using connection to Gradle distribution
‘https://services.gradle.org/distributions/gradle-7.5-bin.zip’.

It reminds us that the gradle version is not compatible. Open the setting and search for gradle. In the setting interface, we find that the Gradle JDK version selects the JDK of Oracle 1.8. Here it is changed to the default JDK library of Android Studio. The default path is jar under the Android Studio folder. folder

Then wait for the download to complete

Change the Gradle JDK path

Restart after the Gradle download is complete, you can see that Android Studio is already working normally

screenshot after update

Guess you like

Origin blog.csdn.net/zhanwaifeixue/article/details/129087437