Reputation: 1378
I am working on a app using Kotlin language and Gradle Build in IntelliJ IDEA IDE. I am getting following error:
Exception in thread "main" kotlin.jvm.KotlinReflectionNotSupportedError: Kotlin reflection implementation is not found at runtime. Make sure you have kotlin-reflect.jar in the classpath
at kotlin.jvm.internal.ClassReference.error(ClassReference.kt:86)
at kotlin.jvm.internal.ClassReference.getQualifiedName(ClassReference.kt:26)
at WorkerKt.main(Worker.kt:62)
I have included the dependencies as mentioned in following answer Add kotlin-reflect dependency in gradle
Even I have added the jar file in libs folder but still I am getting above error at runtime.
My Gradle file is as below:
group 'com.working.workerhelp'
version '1.0-SNAPSHOT'
buildscript {
ext.kotlin_version = '1.2.21'
repositories {
mavenCentral()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
apply plugin: 'kotlin'
repositories {
mavenCentral()
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile "org.jetbrains.kotlin:kotlin-stdlib-jre8:$kotlin_version"
compile "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
testCompile "org.jetbrains.kotlin:kotlin-test:$kotlin_version"
}
compileKotlin {
kotlinOptions.jvmTarget = "1.8"
}
compileTestKotlin {
kotlinOptions.jvmTarget = "1.8"
}
Is there something I need to configure for Gradle Build or am I missing something?
Upvotes: 16
Views: 22103
Reputation: 4329
add implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
in build.gradle(Module:app)
remove compile "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
from project level build.gradle
Upvotes: 28