这个出现在刚打开项目的时候,下载一堆必要的组件……
无法下载gradle的报错信息是:Could not install Gradle distribution from 'https://services.gradle.org/distributions/gradle-8.9-bin.zip'. Reason: java.net.SocketTimeoutException: Read timed out
无法下载gradle.plugin和其他一大堆的报错信息是:(这个报错信息只是无法下载gradle.plugin,但其实这一步AS会同时下载一大堆组件)
Build file 'D:\codes\ascodes\daily_timer\build.gradle.kts' line: 2
Plugin [id: 'com.android.application', version: '8.7.2', apply: false] was not found in any of the following sources:
* Try:
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.
* Exception is:
org.gradle.api.plugins.UnknownPluginException: Plugin [id: 'com.android.application', version: '8.7.2', apply: false] was not found in any of the following sources:
- Gradle Core Plugins (plugin is not in 'org.gradle' namespace)
- Included Builds (No included builds contain this plugin)
- Plugin Repositories (could not resolve plugin artifact 'com.android.application:com.android.application.gradle.plugin:8.7.2')
Searched in the following repositories:
Google
MavenRepo
Gradle Central Plugin Repository
at org.gradle.plugin.use.resolve.internal.PluginResolutionResult.getFound(PluginResolutionResult.java:112)
at org.gradle.plugin.use.internal.DefaultPluginRequestApplicator.resolvePluginRequest(DefaultPluginRequestApplicator.java:192)
at org.gradle.plugin.use.internal.DefaultPluginRequestApplicator.applyPlugins(DefaultPluginRequestApplicator.java:97)
后面的略,总之有很长的重复内容。
解决方案是:
- 其实这几个网站国内都能上,只要网络是正常的,就可以考虑直接等着,反复重试反复重试……
- 在gradle/wrapper/gradle-wrapper.properties文件中,将distributionUrl改成
https\://mirrors.cloud.tencent.com/gradle/gradle-8.9-all.zip
- 设置代理:在C:\Users\用户名.gradle\gradle.properties文件中,增加如下内容:
bro我相信大家都已经对7890这个端口号十分熟悉了,我就不用讲解这个代理是从哪里冒出来的了吧!systemProp.http.proxyHost=127.0.0.1 systemProp.https.proxyHost=127.0.0.1 systemProp.https.proxyPort=7890 systemProp.http.proxyPort=7890
大家熟悉的设置镜像方法对这么新的组件好像基本没啥用,腾讯和阿里好像都没有这么新的组件……大概是降本增效给降得没有本来维护镜像了吧。
标签:plugin,DefaultPluginRequestApplicator,gradle,Studio,https,org,com From: https://blog.csdn.net/PolarisRisingWar/article/details/144517162