Android Studio Build Failed With Kotlin
Solution 1:
You should remove compile "org.jetbrains.kotlin:kotlin-android-extensions:$kotlin_version"
from your dependencies
section and move it to buildscript { dependencies { ... } }
.
Solution 2:
You did put compile "org.jetbrains.kotlin:kotlin-android-extensions:$kotlin_version"
in the wrong build.gradle
file
You may use kotlin
plugin's build-in converters to deal with this. According to Kotlin Docs
:
Configuring Kotlin in the project
When adding a new Kotlin file, IntelliJ IDEA (and Android Studio) automatically prompts us as to whether we'd like to configure the Kotlin runtime for the project. However, currently, converting existing Java file does not prompt this action. Therefore we have to invoke it manually (via Find Action):
We are then prompted for the version of Kotlin. Choose the latest available from the list of installed versions.
After we configure Kotlin, build.gradle file for the application should be updated. Now we can see that apply plugin: 'kotlin-android' and the dependencies were added.
(For more details how to set up gradle for your project, please check Using Gradle)
The last thing to do is to sync the project. We can press
Sync Now
in a prompt or invoke an action Sync Project with Gradle Files.From: https://kotlinlang.org/docs/tutorials/kotlin-android.html
Check link above for more information.
Hope it will help.
Solution 3:
you need to apply only one plugin, in your case apply plugin: 'kotlin-android-extensions'
and only compile "org.jetbrains.kotlin:kotlin-android-extensions:$kotlin_version"
this dependency. it worked for me
Post a Comment for "Android Studio Build Failed With Kotlin"