Kamel-Media / Kamel

Kotlin asynchronous media loading and caching library for Compose.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

cannot inline bytecode built with JVM target 11

anshulupadhyay03 opened this issue · comments

Hi ,
I am using this library on my Compose ios multiplatform app. Everything works fine on the ios app but when I compile and run Android app it throws this error.
Cannot inline bytecode built with JVM target 11 into bytecode that is being built with JVM target 1.8. Please specify proper '-jvm-target' option

And the error it throws on this line when I try to make asyncPainterResource:
val painterResource = asyncPainterResource(data = "https://image.tmdb.org/t/p/original${item.imageUrl}")

I have my common build.gradle file here : https://pastebin.com/WcbmF812

version Used : media.kamel:kamel-image:0.5.1

commented

I've done a temporary workaround and put @file:Suppress("INLINE_FROM_HIGHER_PLATFORM") at the top of the file where it's complaining in.

@jakepurple13 thanks for the workaround.
@contributers : do we have a proper fix for that?

You could just set your project's target to be JVM 11, or do you have a reason to not do that?

@luca992 I created this kmm project through the Android studio and did not set any jvm target manually. should I change that and will it impact anything in my project?

@youranshul android studio uses 11 by default. Try setting target and source compatibility to 11 like in the sample here:

android {
compileSdk = 33
defaultConfig {
minSdk = 21
targetSdk = 33
versionCode = 1
versionName = "1.0"
multiDexEnabled = true
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}

@luca992 I have tried setting it on Android's build.gradle.kts but the issue is the same.

@youranshul try 0.7.2-SNAPSHOT I think it should not have that issue anymore. I'll publish a new version if that works