Solution: Plugin [id: ‘org.gradle.kotlin.kotlin-dsl‘, version: ‘4.0.6‘] was not found
解决Android Studio sync的时候报Plugin [id: 'org.gradle.kotlin.kotlin-dsl', version: '4.0.6'] was not found in any of the following sources错误问题。
·
今天在Android Studio上,sync工程的时候遇到了下面的问题:
Plugin [id: 'org.gradle.kotlin.kotlin-dsl', version: '4.0.6'] 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.
* Exception is:
org.gradle.api.plugins.UnknownPluginException: Plugin [id: 'org.gradle.kotlin.kotlin-dsl', version: '4.0.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:4.0.6')
Searched in the following repositories:
Gradle Central Plugin Repository
at org.gradle.plugin.use.internal.DefaultPluginRequestApplicator.resolveToFoundResult(DefaultPluginRequestApplicator.java:237)
at org.gradle.plugin.use.internal.DefaultPluginRequestApplicator.lambda$resolvePluginRequests$3(DefaultPluginRequestApplicator.java:167)
at org.gradle.util.internal.CollectionUtils.collect(CollectionUtils.java:212)
at org.gradle.util.internal.CollectionUtils.collect(CollectionUtils.java:206)
at org.gradle.plugin.use.internal.DefaultPluginRequestApplicator.resolvePluginRequests(DefaultPluginRequestApplicator.java:165)
at org.gradle.plugin.use.internal.DefaultPluginRequestApplicator.applyPlugins(DefaultPluginRequestApplicator.java:100)
at org.gradle.kotlin.dsl.provider.PluginRequestsHandler.handle(PluginRequestsHandler.kt:48)
at org.gradle.kotlin.dsl.provider.StandardKotlinScriptEvaluator$InterpreterHost.applyPluginsTo(KotlinScriptEvaluator.kt:202)
at org.gradle.kotlin.dsl.execution.Interpreter$ProgramHost.applyPluginsTo(Interpreter.kt:405)
问题分析
因为Android Studio不能下载依赖,需要设置代理,我在Android Studio中设置了socks代理。但是总是下载不成功,每次sync的时候都报错。我以为是gradle的网站出问题了,用浏览器直接访问是没问题的。后来想到了以前好像遇到类似的问题,Android Studio需要设置http代理。修改为http代理之后工程可以正常sync了。
解决方案
在Android Studio中设置http代理。
魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。
更多推荐



所有评论(0)