The new version of the android studio gradle plugin 7.4.2.pom has been unable to download the problem

org.gradle.api.plugins.UnknownPluginException occurs during android studio synchronization, Plugin [id: 'com.android.application', version: '7.4.2'] was not found in any of the following sources:

The pom plug-in has been unable to be downloaded. I have been working on it for several days. I just want to smash the computer. Today, I was irritable and messed around.

Is the android studio proxy problem:

        The default is not to set the proxy. After the installation, there will be a prompt to set the proxy. In fact, setting the proxy is wrong. According to the method of others, the mirror site address of the Chinese Academy of Sciences Open Source Association is set: mirrors.opencas.ac.cn Port: 80, At this time, gradle-7.5-bin can be downloaded but the pom plugin cannot be downloaded.

The solution is: Preferences... => System Settings => HTTP Proxy => select Auto-detect proxy settings, do not set the URL check box inside, leave it empty, I just set the URL to cause the problem, the selection is as follows :

 Click Apply to exit and synchronize the project. At this time, the proxy setting window may pop up, uncheck "Enable HTTPS Proxy" (it is checked by default):

 At this time, gradle.properties is like this:

 

The following steps are not necessary to solve the problem, but the process of trying to solve the problem:

I tried to download the pom file manually before, and after searching for a long time, I finally found the URL of the pom file: https://maven.google.com/web/index.html#com.android.application:com.android.application.gradle.plugin

All plug-ins are in this directory, and clicking on a plug-in will list the plug-in details:

 

 The plug-in is downloaded, but where to put it, the plug-in directory is not created at the beginning, this directory is /Users/xxx/.gradle/caches/modules-2/files-2.1, files-2.1 has not been created at the beginning , after android studio is installed, it will only be generated in the modules-2 directory (file2-2.1 will be created only after the synchronization is passed). There are several levels of directories in files-2.1, which are divided into application and library. The complete directory is as follows:

com.android.application plugin directory: /Users/xxx/.gradle/caches/modules-2/files-2.1/com.android.application/com.android.application.gradle.plugin/7.4.2/xxxx-uuid/ com.android.application.gradle.plugin-7.4.2.pom

com.android.library plugin directory: /Users/xxx/.gradle/caches/modules-2/files-2.1/com.android.library/com.android.library.gradle.plugin/7.4.2/xxxx-uuid/ com.android.library.gradle.plugin-7.4.2.pom
 

There is a random name (xxx-uuid) in it, which should be generated with uuid. It is a random string directory. It can be seen that there must be a configuration file that needs to be set with its complete path android studio to find it. It is definitely not reliable through manual methods. .

In addition, there is also a pom file and moudle file under this directory com.android.tools.build: /Users/xxx/.gradle/caches/modules-2/files-2.1/com.android.tools.build/gradle/7.4.2 /b8e7933310de7f43a224708f3a945d6bb6668eba/gradle-7.4.2.pom, /Users/xxx/.gradle/caches/modules-2/files-2.1/com.android.tools.build/gradle/7.4.2/cd22337f99b5a2446 abfa6a1769730cf74dd15d4/gradle-7.4.2
It is not clear where to download the pom and module of .module. There are gradle-7.4.2.jar and gradle-7.4.2-sources.jar in it. I don’t know where to download these files. In short, manual download is not It is impossible to complete all the configurations. During the synchronization, many jars and other files were downloaded. The files-2.1 folder did not exist before. After the synchronization, many folders appeared in it, including the com.android.application and com. android.library, it can be seen that the manual mode cannot be played.

If the method described above does not work, I suggest you go to Google. The following is a discussion on stackoverflow. I hope it can help you. java - Gradle sync failed: Plugin [id: 'com.android.application', version: '7.1. 2', apply: false] was not found in any of the following sources: - Stack Overflow

Guess you like

Origin blog.csdn.net/dongtinghong/article/details/130407680