Android 找不到参数[gradle plugin,1.3.20]的方法kotlin()

Android 找不到参数[gradle plugin,1.3.20]的方法kotlin(),android,gradle,kotlin,Android,Gradle,Kotlin,我完全复制了实现kotlin gradle插件的内容,但是它返回了以下错误: 在org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler类型的对象上找不到参数[gradle plugin,1.3.20]的方法kotlin() 我的毕业典礼 buildscript { ext.kotlin_version = '1.3.0' repositories { google()

我完全复制了实现kotlin gradle插件的内容,但是它返回了以下错误:

在org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler类型的对象上找不到参数[gradle plugin,1.3.20]的方法kotlin()

我的毕业典礼

buildscript {
    ext.kotlin_version = '1.3.0'
    repositories {
        google()
        jcenter()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:3.3.0'
        classpath(kotlin("gradle-plugin", version = "1.3.20"))

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
//    ext {
//        navigationVersion = '28.0.0'
//    }
    plugins {
        kotlin("<...>")
    }
}


allprojects {
    repositories {
        google()
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}
buildscript{
ext.kotlin_版本='1.3.0'
存储库{
谷歌()
jcenter()
}
依赖关系{
classpath'com.android.tools.build:gradle:3.3.0'
类路径(kotlin(“gradle插件”,version=“1.3.20”))
//注意:不要将应用程序依赖项放在此处;它们属于
//在单个模块build.gradle文件中
}
//分机{
//navigationVersion='28.0.0'
//    }
插件{
科特林(“”)
}
}
所有项目{
存储库{
谷歌()
jcenter()
}
}
任务清理(类型:删除){
删除rootProject.buildDir
}

有什么想法吗?

build.gradle
可以用Groovy或Kotlin编写。您正在Groovy中键入
build.gradle
(不是Kotlin),但是您复制了Kotlin代码。您应该在文档中选择Groovy选项卡:

buildscript {
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath "com.android.tools.build:gradle:3.3.0"
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.20"
    }

}
在这里:

您还可以通过创建一个空的Android和Kotlin项目找到一个不错的例子