androidkotlinkotlin-android-extensionskotlin-extensiongradle-experimental

Could not find method androidExtensions()


I want to use the features of kotlin @Parcelize, I have apply the plugin: 'kotlin-android-extensions' on gradle, and I added

androidExtensions { 
    experimental = true 
}

but errors continue to appear.this error message :

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>

Solution

    • Use the latest version of Kotlin (>= v1.1.51)
    • Use the latest version of Kotlin Android Extensions in your app module, so your build.gradle may look like:
    apply plugin: 'com.android.application'
    apply plugin: 'kotlin-android'
    apply plugin: 'kotlin-android-extensions'
    
    android {
       androidExtensions {
         experimental = true
       } 
    }
    
    dependencies {
      // ...
    }