android - 找不到方法 androidExtensions()

标签 android kotlin kotlin-android-extensions kotlin-extension gradle-experimental

我想使用kotlin @Parcelize的特性, 我在 gradle 上应用了插件:'kotlin-android-extensions',我添加了

androidExtensions { 
    experimental = true 
}

但错误继续出现。此错误消息:

Error:(28, 0) Could not find method androidExtensions() for arguments [build_8di01fmxa4d18k9q0yy3fdd20$_run_closure2@27f46852] on project ':app' of type org.gradle.api.Project.
<a href="openFile:F:\BELAJAR\ANDROID\AndroidStudioProjects\KADE\app\build.gradle">Open File</a>

最佳答案

  • 使用最新版本的 Kotlin (>= v1.1.51)
  • 在您的应用模块中使用最新版本的 Kotlin Android 扩展, 所以你的 build.gradle 可能看起来像:
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'

android {
   androidExtensions {
     experimental = true
   } 
}

dependencies {
  // ...
}

关于android - 找不到方法 androidExtensions(),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52902720/

相关文章:

amazon-web-services - 具有 StaticTableSchema 的嵌套 bean 和来自 AWS Java SDK 2.x 的增强型 DynamoDB 客户端

dependency-injection - 在 Kodein 依赖注入(inject)中,如何将 Kodein 本身的实例注入(inject)到实例中?

java - 如何在 Spring 中获取 Cognito 用户的组?

Kotlin - 如何使用 OkHttp Kotlin 设置连接超时

android - 如何在 AndroidX 中实例化 ViewModel?

java - java中的JSON对象读取

android - 编排 NullPointerException

android - 在 GridView 持有者模式中显示多次的复选框

android - Dagger2 不生成 Dagger 类

java - BLE 连接的后台服务