问题描述:
在Kotlin中调用Java接口中的静态方法时,会报以下错误:
Calls to static methods in Java interfaces are prohibited in JVM target 1.6. Recompile with '-jvm-target 1.8'
解决方法:
在module的build.gradle
文件中添加如下代码即可:
android{
...
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
}