-
-
Notifications
You must be signed in to change notification settings - Fork 175
Description
(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
jvmToolchain
inkotlin
block 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