android studio:无法获取未知属性“kotlin\u version”

klh5stk1  于 2021-07-06  发布在  Java
关注(0)|答案(1)|浏览(309)

从这里克隆git之后,
我第一次面对这个错误:

1: Task failed with an exception.
-----------

* Where:

Build file 'C:\...\voicegym\app\build.gradle' line: 3

* What went wrong:

A problem occurred evaluating project ':app'.
> Could not initialize class org.jetbrains.kotlin.gradle.internal.KotlinSourceSetProviderImplKt

按照这个建议,我把这些添加到 build.gradle (Project: voicegym) ```
buildscript {
ext.kotlinVersion = '1.3.72' // previously '1.2.60'
ext.springBootVersion = '2.0.4.RELEASE'
ext.anko_version='0.10.4'
repositories {
...
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.1.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}

现在,我有一个错误

Build file 'C:...\voicegym\build.gradle' line: 5

A problem occurred evaluating root project 'voicegym'.

Could not get unknown property 'kotlin_version' for object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.

bd1hkmkf

bd1hkmkf1#

经过试验,应该是 ext.kotlin_version=... 而不是 ext.kotlinVersion =... ```
buildscript {
ext.kotlin_version= '1.3.72' // previously '1.2.60'
ext.springBootVersion = '2.0.4.RELEASE'
ext.anko_version='0.10.4'
repositories {
...
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.1.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}

相关问题