-
-
Notifications
You must be signed in to change notification settings - Fork 180
"Cannot inline bytecode" error in KMP project module #762
-
(Note: this is not a project bug, just a fix for a nasty error encountered during use that others may run into; leaving breadcrumbs here in case anyone else is looking for answers)
If you are using gitlive firebase in a KMP (Kotlin Multiplatform) project module and your (android) build breaks with error e.g.
Cannot inline bytecode built with JVM target 17 into bytecode that is being built with JVM target 1.8.
Specify proper '-jvm-target' option.
the fix consists of 2 things:
- Add
jvmToolchaininkotlinblock ofbuild.gradle.kts - Check for installed JDK 17 and if not present, download and install
The usual workflow of setting JDK version in android studio "Project Structure" settings isn't supported for KMP modules; for kmp module the solution should be as simple as adding jvmToolchain() in kotlin block in build.gradle.kts
kotlin {
jvmToolchain(17)
Also run this command in terminal (Android Studio terminal should work fine)
/usr/libexec/java_home -V
If JDK 17 not displayed in command output, download from e.g. oracle and install; should be picked up without any further steps required
Beta Was this translation helpful? Give feedback.
All reactions
-
👍 1
Replies: 1 comment
-
I’m hitting the same issue here. I switched to JDK 17 and added jvmToolchain(17) in the KMP module, but the build still fails with the same error. Has anyone managed to resolve this or found an alternative fix?
Beta Was this translation helpful? Give feedback.