添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接

昨天笔记本重装了系统,今天下载安装了最新的版本:Android Studio 4.2,然后创建一个新项目后就出现了异常,如下:

A problem occurred configuring root project 'HelloWorld'.
> Could not resolve all artifacts for configuration ':classpath'.
   > Could not find org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.0-release-764.
     Searched in the following locations:
       - https://dl.google.com/dl/android/maven2/org/jetbrains/kotlin/kotlin-gradle-plugin/1.5.0-release-764/kotlin-gradle-plugin-1.5.0-release-764.pom
       - https://repo.maven.apache.org/maven2/org/jetbrains/kotlin/kotlin-gradle-plugin/1.5.0-release-764/kotlin-gradle-plugin-1.5.0-release-764.pom
     Required by:
         project :
Possible solution:
 - Declare repository providing the artifact, see the documentation at https://docs.gradle.org/current/userguide/declaring_repositories.html

在StackOverflow上找到了答案,把项目下的build.gradle中的kotlin版本改一下即可,原来的kotlin版本如下:

buildscript {
    ext.kotlin_version = "1.5.0-release-764"

改为如下即可:

buildscript {
    ext.kotlin_version = "1.5.0"

此时,会提示你1.5.0版本与IDE捆绑的1.5.0-release-764版本不同(如下图),不用管它,这个版本就是没法使用的,Google公司是真粗心大意啊,搞一个不能用的版本放到这真是搞笑,在考验大家解决问题的能力呢!
在这里插入图片描述

解决Plugin [id: 'org.jetbrains.kotlin.android', version: '1.6.21', apply: false] was not found in any of kotlin-compiler-embeddable-1.3.50.jar下载后直接可用(亲测)。Could not download kotlin-compiler-embeddable.jar,是墙的原因 没有下载下来kotlin-compiler-embeddable.jar的jar包资源。 把下载好的jar,放在版本文件的子目录中,重新启动电脑就可以。网上都有对应的操作指引 Failed to notify project evaluation listener. Could not initialize class org.jetbrains.kotlin.gradle.plugin.sources.DefaultLanguageSettingsBuilderKt Could not initialize class org.jetbrains.kotlin.gradle.plugin.sources.DefaultLanguageS 报错Could not initialize class org.jetbrains.kotlin.gradle.plugin.sources.DefaultKotlinSourceSetKt ext.kotlin_version = '1.5.31' repositories { maven{ url 'https://maven.aliyun.com/repository/google'} maven{ url 'https://maven.aliyun.com/repository/gradle-plugin'} maven{ url 'https://maven.aliyun.com/repository/public'} 解决 Could not find org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.31-release-542.