Kamel-Media / Kamel

Kotlin asynchronous media loading and caching library for Compose.
Apache License 2.0
595 stars 23 forks source link

cannot inline bytecode built with JVM target 11 #38

Closed anshulupadhyay03 closed 1 year ago

anshulupadhyay03 commented 1 year ago

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

jakepurple13 commented 1 year ago

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.

anshulupadhyay03 commented 1 year ago

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

luca992 commented 1 year ago

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

anshulupadhyay03 commented 1 year ago

@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?

luca992 commented 1 year ago

@youranshul android studio uses 11 by default. Try setting target and source compatibility to 11 like in the sample here: https://github.com/Kamel-Media/Kamel/blob/e3b58c0768c3993c13489a7f9cfceb640aa2e3a2/kamel-samples/build.gradle.kts#L17-L32

anshulupadhyay03 commented 1 year ago

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

luca992 commented 1 year ago

I'm going to close this. If you want make a sample and I'll reopen it and take another look. But here's some relevant info.

https://stackoverflow.com/questions/48988778/cannot-inline-bytecode-built-with-jvm-target-1-8-into-bytecode-that-is-being-bui

https://youtrack.jetbrains.com/issue/KTIJ-20816/Bogus-error-Cannot-inline-bytecode-built-with-JVM-target-11-into-bytecode-that-is-being-built-with-JVM-target-1.8.

luca992 commented 10 months ago

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