在运行构建时,我得到以下错误
FAILURE: Build failed with an exception.
* Where:
Build file '/home/charming/mainframer/bigovlog_android/buildSrc/build.gradle.kts' line: 4
* What went wrong:
Plugin [id: 'org.gradle.kotlin.kotlin-dsl', version: '1.2.6'] was not found in any of the following sources:
- Gradle Core Plugins (plugin is not in 'org.gradle' namespace)
- Plugin Repositories (could not resolve plugin artifact 'org.gradle.kotlin.kotlin-dsl:org.gradle.kotlin.kotlin-dsl.gradle.plugin:1.2.6')
Searched in the following repositories:
Gradle Central Plugin Repository我的buildSrc/build.gradle.kts
repositories {
jcenter()
}
plugins {
`kotlin-dsl`
id("groovy")
}
dependencies{
gradleApi()
localGroovy()
}我试了所有的方法,但还是不起作用
发布于 2020-02-18 00:42:01
你有没有检查过Android Studio没有在脱机模式下运行?看一看Preferences/Build, Execution, Deployment/Gradle/Global Gradle settings,看看是否选中了脱机工作。
发布于 2019-11-26 17:12:16
同样的构建文件也适用于我。尝试清除项目和主目录中的Gradle缓存,然后检查它是否可以工作。如果仍然失败,请尝试将Gradle和插件更新为最新版本的id("org.gradle.kotlin.kotlin-dsl") version "1.3.2"
发布于 2020-06-16 23:10:15
我也有同样的问题,所以我试了试gradle --info
日志如下:
Evaluating project ':buildSrc' using build file '/Users/fjh1997/mirai/buildSrc/build.gradle.kts'.
I/O exception (org.apache.http.NoHttpResponseException) caught when processing request to {tls}->http://127.0.0.1:1083->https://plugins.gradle.org:443: The target server failed to respond
Retrying request to {tls}->http://127.0.0.1:1083->https://plugins.gradle.org:443
I/O exception (org.apache.http.NoHttpResponseException) caught when processing request to {tls}->http://127.0.0.1:1083->https://plugins.gradle.org:443: The target server failed to respond
Retrying request to {tls}->http://127.0.0.1:1083->https://plugins.gradle.org:443
I/O exception (org.apache.http.NoHttpResponseException) caught when processing request to {tls}->http://127.0.0.1:1083->https://plugins.gradle.org:443: The target server failed to respond似乎把请求传给了proxy 127.0.0.1:1083,但是我在本地gradle.properties文件中设置的proxy的url是127.0.0.1:8118,这是怎么回事?经过长时间的努力,我终于找到了。
实际上,您的系统中有两个gradle.properties配置文件,一个在您的项目/.gradle中,另一个在~/.gradle中,后者是gradle的全局设置。
如果全局设置为systemProp.http.proxyHost设置了变量,那么无论您在项目/.gradle/gradle.properties中设置什么,代理都不起作用,您必须在全局设置中更改它。
顺便说一句,我发现gradle的全局设置被我的android studio偏好所改变。
https://stackoverflow.com/questions/59046202
复制相似问题