Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
3.7k views
in Technique[技术] by (71.8m points)

android studio升级kotlin-gradle-plugin版本后,新建项目报错无法启动

Caused by: org.gradle.api.internal.artifacts.ivyservice.DefaultLenientConfiguration$ArtifactResolveException: Could not resolve all artifacts for configuration ':classpath'.

Caused by: org.gradle.internal.resolve.ModuleVersionResolveException: Could not resolve com.android.tools.build:gradle:3.6.1.

Caused by: org.gradle.internal.resolve.ModuleVersionResolveException: No cached version of com.android.tools.build:gradle:3.6.1 available for offline mode.

kotlin-gradle-plugin 1.3.71 -> 1.4 后, 新建项目无法启动,在build.gradle 把版本改回去也不行。 但旧的项目还能正常运行。

解决方法

重点字眼 offline mode , 把gradle切换成online mode 就解决了。
Andriod studio右上角的gradle面板,打开,里面有个小菜单,倒数第二个,toggle online/offline mode 这里设置。


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

很明显你的 plugin 和 gradle的版本不统一,参考我发你的这个对照表image.png


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...