Problem with kotlin-compiler-embeddable-1.1.60


#1

Good day!
Today I’ve got a strange error while compile my code.
And I really don’t know what I do wrong.
The error is:

Error:com.android.builder.dexing.DexArchiveBuilderException: Failed to process C:\Users\Alexander.Shevelev\.gradle\caches\modules-2\files-2.1\org.jetbrains.kotlin\kotlin-compiler-embeddable\1.1.60\e0ea7c24d46acc433ece025023868bf9ffe5e437\kotlin-compiler-embeddable-1.1.60.jar

Error:com.android.builder.dexing.DexArchiveBuilderException: Error while dexing javaslang/ValueModule.class

Error:com.android.dx.cf.code.SimException: invalid opcode ba (invokedynamic requires --min-sdk-version >= 26)

Error:Execution failed for task ':app:transformClassesWithDexBuilderForDebug'.
> com.android.build.api.transform.TransformException: com.android.builder.dexing.DexArchiveBuilderException: com.android.builder.dexing.DexArchiveBuilderException: Failed to process C:\Users\Alexander.Shevelev\.gradle\caches\modules-2\files-2.1\org.jetbrains.kotlin\kotlin-compiler-embeddable\1.1.60\e0ea7c24d46acc433ece025023868bf9ffe5e437\kotlin-compiler-embeddable-1.1.60.jar

I use Android Studio 3.0.1 (build AI-171.4443003), gradle 4.1 with plugin 3.0.1
Can you help me?


#2

It looks like you have kotlin-compiler-embeddable as a direct or transitive compile/runtime dependency of your android application. Usually the compiler is used as a tool to compile code, rather than as a dependency of that code.

Do you really need it as a dependency? If not, you should check how it has got there. You can run dependencies gradle task to analyze the dependency graph or your project.


#3

Yes, I had to do it for this reason:
https://developer.android.com/studio/build/gradle-plugin-3-0-0-migration.html?utm_source=android-studio#annotationProcessor_config

In my case I disabled error checking by adding this code into gradle script:
javaCompileOptions {
annotationProcessorOptions {
includeCompileClasspath true
}
}

And I found this in my gradle contole output
Caused by: com.android.builder.dexing.DexArchiveBuilderException: Error while dexing org/jetbrains/kotlin/com/intellij/psi/PsiJavaCodeReferenceElement.class
The dependency contains Java 8 bytecode. Please enable desugaring by adding the following to build.gradle
android {
compileOptions {
sourceCompatibility 1.8
targetCompatibility 1.8
}
}