Skip to content

Kotlin Multiplatform "Bundle not found" when accessing image #57

@tethridge

Description

@tethridge

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
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions