Member-only story
Solution: How to fix NoClassDefFoundError and configure Kotlin to work alongside Java in Android Studio?
1 min readJan 1, 2019
For those who’re struggling, I got this working by using Tools > Kotlin > Configure Kotlin in Android Studio. If you don’t have the option, you can manually configure it by:
- Adding the following to the project build.gradle:
buildscript {
ext.kotlin_version = ‘1.2.70'
repositories {
mavenCentral()
}
dependencies {
classpath “org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version”
}
2. Adding the following to the module build.gradle:
apply plugin: ‘kotlin-android’
buildscript {
repositories {
mavenCentral()
}
}
dependencies {
implementation “org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version”
}
Happy Coding!