android studio plugin with id: 'kotlin-android-extensions'

Viewed 7820

I am using gradle and I am trying to add kotlin to my project. But when I am trying to add 'kotlin-android-extensions' plugin for gradle it fails to find it.

3 Answers

Try to add the following to your gradle.build file

apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'

after that you have to make some changes in your dependencies classpath like this.

buildscript {
ext.kotlin_version = '1.1.60'
repositories {
    jcenter()
}
dependencies {
    classpath 'com.android.tools.build:gradle:2.1.0'
    classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"

    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
  }
}

and in dependencies compile make sure to add jre7 such that.

compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"

After doing all that rebuild the gradle and you are all done. This worked for me because i was facing the same problem you are now, and after this it's all done. Hope it works for you tooo....

classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:+" try this

Related