skip to Main Content

hen i try to add kotlin-android-extensions via:

apply plugin: ‘kotlin-android-extensions’

to my project Android Studio tells me Plugin with ‘kotlin-android-extensions not found??

What is going wrong? I am Running Android Studio

3

Answers


  1. Kotlin Android Extensions has been deprecated for two years and should not be used in new products.

    As of Kotlin 1.8, it is not available at all anymore.

    I don’t think they’ve officially turned it off yet, since Kotlin 1.8 hasn’t officially been released, so there is probably some config issue in your project’s Gradle files, but it doesn’t matter, because you should not rely on a plugin that is going to stop working within 3 months.

    Login or Signup to reply.
  2. As "kotlin-android-extensions" is deprecated now, it’s better to use view binding.
    just head to the module-level build.gradle and add inside the android block:

        buildFeatures {
            viewBinding = true
        }
    

    then you will be able to use binding variables to reference views from your activities and fragments, all you need is here, but if you have any additonal questions to viewBinding just leave a comment

    Login or Signup to reply.
  3. It’s deprecated Base on the google document

    Kotlin Android Extensions is deprecated, which means that using Kotlin
    synthetics for view binding is no longer supported.

    for those who’s wonder what the synthetic is. I should say a simple way to access to UI view id with kotlin which was possible by adding 'kotlin-android-extensions' in Gradle.

    • If your app uses Parcelable you can use 'kotlin-parcelize' instead of 'kotlin-android-extensions'.
    • If your app uses Kotlin synthetics for view binding, use this guide to migrate to Jetpack ViewBinding or Data Binding.

    you can add any of it like the following

    android {
        ...
        buildFeatures {
            dataBinding true
        }
    }
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search