JetBrains / compose-multiplatform

Compose Multiplatform, a modern UI framework for Kotlin that makes building performant and beautiful user interfaces easy and enjoyable.
https://jetbrains.com/lp/compose-multiplatform
Apache License 2.0
15.17k stars 1.11k forks source link

When targeting Android for a KMP project using `Coil 3.0.0-alpha06`, attempting to use `.toBitmap()` and `.asComposeImageBitmap()` results in `Unresolved reference` #4797

Closed realityexpander closed 1 month ago

realityexpander commented 1 month ago

Describe the bug This problem only exists on Android for KMP, for the Coil 3.0.0-alpha06 library.

Attempting to use the results of a pre-loaded imageLoader.execute(imageResquest).image in an Image Composable by converting it using .toBitmap() and .asComposeImageBitmap() results in a compile-time errors:

Unresolved reference: toBitmap Unresolved reference: asComposeImageBitmap

Note:

I'm not sure if this is a configuration issue, I checked all the examples and the Coil 3 upgrade guide, and could see no differences.

Referencing this conversation: https://github.com/coil-kt/coil/issues/2246

To Reproduce Here's the line that won't compile when targeting Android: https://github.com/realityexpander/CloudCoverUSA2/blob/56d7575ac95903974b099738a015994aa5fdb972/composeApp/src/commonMain/kotlin/App.kt#L302

Code: https://github.com/realityexpander/CloudCoverUSA2/releases/tag/coil3.alpha06.bug.report

Logs/Screenshots image

Version What library version are you using? Does this occur on a specific API level or Android device? coil 3.0.0.alpha-06

colinrtwhite commented 1 month ago

As previously mentioned, this issue isn't directly related to Coil. You can reproduce the issue by not importing Coil at all and adding a reference to org.jetbrains.skia.Bitmap in common code.

MatkovIvan commented 1 month ago

Both mentioned functions are not available in common/Android, they are defined in the appropriate source set. Issue for tracking the problem that IDE shows such suggestions: #3503