android - "Extension with name ' android ' does no

当我尝试使用 the official Kotlin tutorial 将 Kotlin 添加到我们的 Android 项目时, Gradle 无法启动错误Extension with name 'android' does not exist.

最佳答案

Android Studio 修改你的 build.gradle 添加 apply plugin: 'kotlin-android' 上面 apply plugin: 'com.android.application'。只需将 Kotlin 行移到 Android 行下方,Gradle 就会顺利运行。它应该看起来像这个例子:

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'

关于android - "Extension with name ' android ' does not exist"将 Kotlin 添加到 Android 项目时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42158019/

相关文章:

enums - 如何在 Kotlin 中声明枚举类型的变量?

android - 在 ConstraintLayout 中使用 group 来监听多个 View

android - 如何在 androidTest 范围内使用 kapt

android - 在 Kotlin 中将接口(interface)作为参数传递

lambda - 在 lambda 中使用 return?

android - 如何通过 kotlin 中的 Intent 传递自定义对象

types - Kotlin:从列表(或其他功能转换)中消除空值

kotlin - 从 java 中调用作为 java 中关键字的 kotlin 函数?

kotlin - 比较字符串 Kotlin

intellij-idea - Kotlin - IntelliJ 项目设置