为什么安装了 kotlin 插件的 kotlin 无法在 android studio 中工作

Why is kotlin not working in android studio with the kotlin plugin install

我是 KotlinAndroid Studio 的新手,但至少我按照 JetBrains 网站上的说明进行设置,但我一直在与这些错误作斗争:

Error:(16, 0) Extension with name 'android' does not exist. 
Currently registered extension names: [ext, kotlin]

https://kotlinlang.org/docs/reference/using-gradle.html#targeting-android

buildscript {
    ext.kotlin_version = '<version to use>'

    ...

    dependencies {
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    }
}
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'

你好像漏掉了

    apply plugin: 'com.android.application'

Android Studio 2.3.3 不支持 kotlin sdk 下载 android 工作室 3.0


https://developer.android.com/studio/preview/index.html

Google 正式宣布 Android Studio 3.0 + 支持 Kotlin。 Android Studio 3.0 支持 Canary channel. Try working with Android Studio 3.0 Canary to get right amount of support and ease for Kotlin Android 语言。