Comments (17)
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
}
from kamel.
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)
from kamel.
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.
from kamel.
1.0.0-beta.2 should work on iOS out of the box without setting your own config
from kamel.
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.
from kamel.
configOverride is supposed to be internal. Just fyi
from kamel.
@DjuroRad should be fixed in 1.0.0-beta.3
from kamel.
did you read the release notes?
https://github.com/Kamel-Media/Kamel/releases/tag/v1.0.0-beta.1
from kamel.
I did, I went over them. Is there something that's obviously wrong with the example I provided?
from kamel.
no that should be fine.
are you using implementation("media.kamel:kamel-image-default:1.0.0-beta.1")
?
I can't really help you without more details or at least the stack trace of the error that is being passed to onFailure
from kamel.
reflection shouldn't be required. Did you make you happen to make your own KamelConfig?
If you just need it to work I would suggest using a non-beta v0.9 build for now.
from kamel.
I am using version 0.9.3
. No issues with that version. I didn't make my own KamelConfig
. It worked out of box in the previous versions.
Now that you mentioned it, I see that LocalKamelConfig
defaults to KamelConfig.Core
In KamelConfigImage.kt
public var configOverride: KamelConfig? = null
public val LocalKamelConfig: ProvidableCompositionLocal<KamelConfig> =
staticCompositionLocalOf { configOverride ?: KamelConfig.Core }
And if I update it to KamelConfig.Default
KamelConfig {
configOverride = KamelConfig.Default
}
it will now work 😃
I also see that KamelConfig.Default
uses takeFrom
from KamelConfig.Core
public val KamelConfig.Companion.Default: KamelConfig
get() = KamelConfig {
takeFrom(KamelConfig.Core)
imageBitmapDecoder()
imageVectorDecoder()
svgDecoder()
platformSpecificConfig()
}
and beside decoders adds the expect
ed platformSpecificConfig()
Is this intended behaviour? I think it should be provided somewhere within the README.md
or the release notes since this happens out of box when using KMP wizard which is used by a lot of people experimenting with compose multiplatform.
Do you intend to keep it like this or maybe change the configOverride
to default to KamelConfig.Default
instead of KamelConfig.Core
?
Wdyt luca?
from kamel.
Regarding the initializer 😃 (though I always suspect a possible IDE issue)
from kamel.
That is intended.
Are you having this issue on ios only? That is the only target I am able to duplicate it on
from kamel.
@luca992 version beta.2
fixes the issue on iOS but the issues is still present on Android. Same stacktrace and everything. Even if I set the configOverride
manually on Android it doesn't fix it now.
On version beta.1
setting configOverride = KamelConfig.Default
fixes the issue for both iosMain
and androidMain
targets whereas beta.2
doesn't fix it for Android (iOS works out of box)
Should I create another issue and reference this one or you would like to reopen this one?
from kamel.
Yap, but doesn't work even when specifying it
from kamel.
I checked it now with just using within the main composable called App
and adding the following (same as previosuly) made it work
KamelConfig {
configOverride = KamelConfig.Default
}
I should've invalidated the caches, my bad
from kamel.
Related Issues (20)
- Add wasmJS target HOT 7
- how to skip memory cache in kamel HOT 1
- File URLs should be handled as such on JVM platform HOT 16
- Make heavyweight dependencies optional HOT 3
- Problem with SVG on iOS HOT 1
- Expand onSuccess to function parameter HOT 2
- KamelImage fills up max size HOT 5
- Is it possible to have access to the image Height when the resource state is Loading or Error? HOT 3
- Support compose multiplatform for kotlin/JS [1.6.0] HOT 2
- Ability to trigger reload on loading failure HOT 2
- Persistent cache is not working HOT 2
- Bug: animation triggers every time the loading progress changes HOT 1
- Disk cache doesn't work on iOS and Android HOT 4
- Can't load images from disk cache when offline HOT 1
- Base64 Encoded Images HOT 3
- 1.0.0-beta.6 compatibility with latest stable Ktor HOT 3
- iOS-only: `IrCallImpl: 1` compilation error when passing a Kamel `File` to `asyncPainterResource` with Kotlin 2.0.0 HOT 6
- Duplicate class co.touchlab.stately.collections.FunctionsKt HOT 5
- How to load image bitmap? HOT 31
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from kamel.