Kamel: KamelConfig.Default does not load automatically with v1 beta

Steps to reproduce:

Use KMP wizard by following this link and create multiplatform project sharing UI for iOS and Android Use version of kamel 1.0.0-beta.1 (ktor client version 2.3.8)

KamelImage(
            resource = asyncPainterResource(data = "https://picsum.photos/200"),
            contentDescription = null,
            modifier = Modifier
                .size(230.dp)
                .background(color = Color.Green),
            onFailure = {
                Text(text = "failed")
            },
            onLoading = {
                Text(text = "loading")
            }
        )

Result: KamelImage’s onFailed will be rendered

About this issue

  • Original URL
  • State: closed
  • Created 4 months ago
  • Comments: 17 (10 by maintainers)

Commits related to this issue

Most upvoted comments

I was able to duplicate it. But specifying the default config does work as it should.

val kamelConfig = remember {
    KamelConfig {
        takeFrom(KamelConfig.Default)
    }
}
CompositionLocalProvider(LocalKamelConfig provides kamelConfig) {
    // your composeable
}

@DjuroRad should be fixed in 1.0.0-beta.3

configOverride is supposed to be internal. Just fyi

Hmm strange. I couldn’t cause the same issue on android. Also,configOverride should not be exposed in beta 2 anymore. But either way you should be able to specify the default config to be used with the method described in the readme.

1.0.0-beta.2 should work on iOS out of the box without setting your own config

configOverride is supposed to be set to KamelConfig.Default automatically here.

It sounds like it’s not actually being set automatically, I’ll look into it. And the 1.0 build is definitely still a beta. I would hope no one is setting that to be used in a wizard rather than the stable build.

Yes, I am using kamel-image-default name from media.kamel group. I tried it with almost any name available.
I tried with other names from your group also, added kamel-decoder-image-bitmap just in case. Also tried adding implementation( "org.jetbrains.kotlin:kotlin-reflect:1.9.21") explicitly but that didn’t help either

Sorry about forgeting the stacktrace, here it is

2024-02-29 09:22:23.611  9646-9646  System.out              org.example.melodyreservation        I  java.lang.IllegalStateException: Unable to find a decoder for interface androidx.compose.ui.graphics.ImageBitmap (Kotlin reflection is not available) 
2024-02-29 09:22:23.611  9646-9646  System.out              org.example.melodyreservation        I   message: Unable to find a decoder for interface androidx.compose.ui.graphics.ImageBitmap (Kotlin reflection is not available)
2024-02-29 09:22:23.611  9646-9646  System.out              org.example.melodyreservation        I  stacktrace: java.lang.IllegalStateException: Unable to find a decoder for interface androidx.compose.ui.graphics.ImageBitmap (Kotlin reflection is not available)
2024-02-29 09:22:23.611  9646-9646  System.out              org.example.melodyreservation        I  	at io.kamel.core.ImageLoadingKt$loadImageBitmapResource$$inlined$loadResource$1.invokeSuspend(ImageLoading.kt:107)
2024-02-29 09:22:23.611  9646-9646  System.out              org.example.melodyreservation        I  	at io.kamel.core.ImageLoadingKt$loadImageBitmapResource$$inlined$loadResource$1.invoke(Unknown Source:8)
2024-02-29 09:22:23.611  9646-9646  System.out              org.example.melodyreservation        I  	at io.kamel.core.ImageLoadingKt$loadImageBitmapResource$$inlined$loadResource$1.invoke(Unknown Source:4)
2024-02-29 09:22:23.611  9646-9646  System.out              org.example.melodyreservation        I  	at kotlinx.coroutines.flow.SafeFlow.collectSafely(Builders.kt:61)
2024-02-29 09:22:23.611  9646-9646  System.out              org.example.melodyreservation        I  	at kotlinx.coroutines.flow.AbstractFlow.collect(Flow.kt:230)
2024-02-29 09:22:23.611  9646-9646  System.out              org.example.melodyreservation        I  	at kotlinx.coroutines.flow.FlowKt__ErrorsKt.catchImpl(Errors.kt:156)
2024-02-29 09:22:23.611  9646-9646  System.out              org.example.melodyreservation        I  	at kotlinx.coroutines.flow.FlowKt.catchImpl(Unknown Source:1)
2024-02-29 09:22:23.611  9646-9646  System.out              org.example.melodyreservation        I  	at kotlinx.coroutines.flow.FlowKt__ErrorsKt$catch$$inlined$unsafeFlow$1.collect(SafeCollector.common.kt:114)
2024-02-29 09:22:23.611  9646-9646  System.out              org.example.melodyreservation        I  	at androidx.compose.runtime.SnapshotStateKt__SnapshotFlowKt$collectAsState$1$2.invokeSuspend(SnapshotFlow.kt:66)
2024-02-29 09:22:23.611  9646-9646  System.out              org.example.melodyreservation        I  	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
2024-02-29 09:22:23.611  9646-9646  System.out              org.example.melodyreservation        I  	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:108)
2024-02-29 09:22:23.611  9646-9646  System.out              org.example.melodyreservation        I  	at kotlinx.coroutines.internal.LimitedDispatcher$Worker.run(LimitedDispatcher.kt:115)
2024-02-29 09:22:23.611  9646-9646  System.out              org.example.melodyreservation        I  	at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:103)
2024-02-29 09:22:23.611  9646-9646  System.out              org.example.melodyreservation        I  	at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:584)
2024-02-29 09:22:23.611  9646-9646  System.out              org.example.melodyreservation        I  	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:793)
2024-02-29 09:22:23.611  9646-9646  System.out              org.example.melodyreservation        I  	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:697)
2024-02-29 09:22:23.611  9646-9646  System.out              org.example.melodyreservation        I  	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:684)