今天在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代理。
2546

被折叠的 条评论
为什么被折叠?



