gradle android 中的 MissingPropertyException

MissingPropertyException in gradle android

我正在构建 gradle 文件中创建一些常量,但在构建时出现以下错误

A problem occurred evaluating root project 'App'.

Exception evaluating property 'gradle' for java.util.ArrayList, Reason: groovy.lang.MissingPropertyException: No such property: gradle for class: java.lang.String

这是我的顶层gradle,我正在其中进行更改

buildscript {
ext{
    compileSdkVersion = 31
    targetSdkVersion = 31
    minSdkVersion = 21
    versions=[
            kotlin='1.6.10',
            gradle='4.2.1'
    ]

}

repositories {
    google()
    mavenCentral()

}
dependencies {
    classpath "com.android.tools.build:gradle:${versions.gradle}"
    classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${versions.kotlin}"
}
}

task clean(type: Delete) {
delete rootProject.buildDir
}

这是由于使用=

引起的语法问题
versions = [
            kotlin : '1.6.10',
            gradlePlugin : '4.2.1'
    ]