libres icon indicating copy to clipboard operation
libres copied to clipboard

Kotlin Multiplatform "Bundle not found" when accessing image

Open tethridge opened this issue 1 year ago • 3 comments

I created a project using the new Compose multiplatform template creator (https://kmp.jetbrains.com/). I then integrated libres and added an image. I added a composable function under commonMain in the composeApp module that includes an image like this:

Image(
    painter = ResImages.ic_baseline_mic_24.painterResource(),
    contentDescription = "Microphone icon",
    colorFilter = ColorFilter.tint(MaterialTheme.colorScheme.onPrimary)
)

This code runs fine on Android, but on iOS I receive an error about the bundle not being found. I can see that the bundle is being generated. Is there another setting that is required?

Uncaught Kotlin exception: kotlin.IllegalStateException: LibresComposeApp.bundle not found
at 0   Fawkes                              0x10058a7f7        kfun:kotlin.Throwable#<init>(kotlin.String?){} + 119 
at 1   Fawkes                              0x100583cdb        kfun:kotlin.Exception#<init>(kotlin.String?){} + 115 
at 2   Fawkes                              0x100583efb        kfun:kotlin.RuntimeException#<init>(kotlin.String?){} + 115 
at 3   Fawkes                              0x100584523        kfun:kotlin.IllegalStateException#<init>(kotlin.String?){} + 115 
at 4   Fawkes                              0x10196088b        kfun:io.github.skeptick.libres.images#bundleWithName__at__platform.Foundation.NSBundle.Companion(kotlin.String){}platform.Foundation.NSBundle + 755

I'm using this as my configuration for libres:

libres {
    generatedClassName = "Res" // "Res" by default
    generateNamedArguments = true // false by default
    baseLocaleLanguageCode = "en" // "en" by default
    camelCaseNamesForAppleFramework = true // false by default
}

tethridge avatar Jan 09 '24 23:01 tethridge