java - 安卓工作室 : Could not get unknown property 'kotlin_version'

标签 java android android-studio kotlin gradle

here 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
关注 this advice ,我将这些添加到 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.

最佳答案

实验后应该是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"
    }
}

关于java - 安卓工作室 : Could not get unknown property 'kotlin_version' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64834818/

相关文章:

java - sqlite android java中没有这样的列

java - 英特尔 MPI mpirun 不会使用 java Process.destroy() 终止

java - 如何确定汽车在图像中的位置?

android - 传递 Serializable 时出现 ClassNotFoundException

Android 添加一个填充,其大小在所有设备上看起来都相同

java - 为什么 Json 无法为 java 枚举正确生成?

android - 无法在 Android JellyBean 中使用最大长度

android - 错误 : Unexpected CPU variant for X86 using defaults: x86

android - 如何使用 sentry-cli 设置 Sentry.io 的默认组织

java - 如何在 Android Studio 中从 AsyncTask 获取数组值到其他方法