android - "Extension with name ' android ' does not exist"将 Kotlin 添加到 Android 项目时出错

标签 android kotlin

当我尝试使用 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/

相关文章:

android - 使用 mockito MVVM 模式在 android 中对 View 模型进行单元测试

android - 如何在 Android 上处理电容器中传入的共享内容

android - 对用户隐藏功能的最佳实践?

android - 单击和取消单击时如何更改复选框颜色?

android - 我无法完成 Activity

android - 协程 : run a Deferred on a specific CoroutineContext

android - 尝试在空对象引用上调用接口(interface)方法 'boolean android.view.inputmethod.InputConnection.finishComposingText()' - Android Kotlin

java - 使 MediaPlayer 停止播放

java - Android TCP 服务器限制

android - Jetpack 组成 : Pending composition has not been applied when rememberSaveable is used