Could not find method androidExtensions()
Asked Answered
U

4

5

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>
Undis answered 20/10, 2018 at 5:29 Comment(0)
O
9
  • 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 {
  // ...
}
Optimum answered 10/1, 2019 at 9:35 Comment(0)
G
3

For Using of Kotlin parcelize you have to follow these steps:

1- Add this line into your Gradle:

apply plugin: 'org.jetbrains.kotlin.android.extensions'

2-Enable android Extensions in your Gradle too :

 androidExtensions {
        experimental = true
    }

That's it. But be aware that you have added apply plugin: 'kotlin-android-extensions' in your gradle too if you didn't before.

Glebe answered 20/10, 2018 at 5:58 Comment(1)
The plugin has since been updated to 'kotlin-android-extensions' as mentioned by @SML, i.e. You no longer need following apply plugin: 'org.jetbrains.kotlin.android.extensions'Subir
S
0

Just add this line in build file classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"

Soapwort answered 25/10, 2018 at 10:15 Comment(0)
K
0
  1. Add these plugins up to step 2.

    • apply plugin: 'com.android.application'
    • apply plugin: 'kotlin-android'
    • apply plugin: 'kotlin-android-extensions'
android {
    androidExtensions {
        experimental = true
    }
}
Kentiga answered 18/5, 2023 at 22:41 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.