[Android Studio] Gradle version Gradle plugin version Java version Androd studio version unification problem

Problem Description

I originally used the version of Android Studio 2020.4, because there was a problem with the computer (space permission + size problem, I moved the location of the . There are many problems.

Document the resolution process.

报错一:Gradle sync failed: The specified Gradle distribution ‘https://services.gradle.org/distributions/gradle-2.10-all.zip’ does not exist.

First put someone else's solution https://www.cnblogs.com/kinoyo/p/11243905.html
and then talk about the situation I encountered

In my case, I am here because there is a problem with the location where I imported Gradle. As I said in the background, I want to move the .gradle folder of the C drive (which stores the downloaded gradle, which is very large) to another drive. I am in Setting -> Build Tools -> Gradle can set the location, directly fill in the path of the .gradle folder I moved, and this problem will appear, which is very confusing.

My solution: I deleted my original .gradle folder and created an empty folder as the Gradle Home in the settings. The original gradle file will be re-downloaded, and the space is replaced with time, which belongs to yes.

Error message:
insert image description here

报错二:Gradle sync failed: Unsupported Gradle. The project uses Gradle 2.10 which is incompatible with Android Studio 2021.2. Possible solution:- Upgrade Gradle wrapper to 3.0 version and re-import the project

As stated in the error report, the updated Android Studio 2021.2 does not support this version of Gradle and needs to be updated.
It is worth mentioning that the Gradle 2.1 version here refers to the Gradle version, which is modified in gradle-wrapper.properties, and the Gradle plug-in version should be distinguished.
insert image description here
Error message:
insert image description here

Error three: Gradle sync failed: Could not find com.android.tools.build:gradle:3.3.0.

This error synchronization error means that the plugin version 3.3.0 cannot be found. It is modified in build.gradle in the project.
insert image description here
Error message:
insert image description here

报错四:Gradle sync failed: Unable to find method ‘com.android.build.gradle.tasks.factory.AndroidJavaCompile.setDependencyCacheDir(Ljava/io/File;)

This is the version matching problem between Gradle and Gradle plugins, similar to the relationship between cudnn, Cuda, and GPU (painful memories)
https://developer.android.com/studio/releases/gradle-plugin The official link is here, you can look it up

报错五:Gradle sync failed: Unable to load class ‘javax.xml.bind.annotation.XmlSchema’. This is an unexpected error.

This is a JDK version problem, you need to modify the JDK path in the settings. 1.8 yyds.
I changed from 11 to jdk1.8
insert image description here
and reported an error message:
insert image description here

Summarize

It was originally the folder where the software was installed in my computer. I don’t know why the permissions are broken. I need administrator permissions. Then I ran out of space on the C drive. I moved the .android and .gradle files, and various permission issues were directly broken. I reinstalled Android Studio, but I didn't know that the new version had various conflicts with my old project, and I was numb at night. Sigh.jpg
Fortunately, it worked out in the end.
insert image description here
insert image description here

Thanks to the answers of several helpful bigwigs:
https://blog.csdn.net/zengsidou/article/details/79797417

https://blog.csdn.net/rjliulei/article/details/79475499?spm=1001.2101.3001.6650.3&utm_medium=distribute.pc_relevant.none-task-blog-2%7Edefault%7ECTRLIST%7Edefault-3-79475499-blog-83824117.pc_relevant_default&depth_1-utm_source=distribute.pc_relevant.none-task-blog-2%7Edefault%7ECTRLIST%7Edefault-3-79475499-blog-83824117.pc_relevant_default&utm_relevant_index=6

https://cloud.tencent.com/developer/article/1847089

Guess you like

Origin blog.csdn.net/m0_54352040/article/details/124905929