icerockdev / moko-resources

Resources access for mobile (android & ios) Kotlin Multiplatform development
https://moko.icerock.dev/
Apache License 2.0
1.03k stars 119 forks source link

Cannot access 'dev.icerock.moko.resources.ResourceContainer' #737

Open Egi10 opened 2 weeks ago

Egi10 commented 2 weeks ago

I encountered an error in my multimodule project after updating to Moko Resources version 0.24.1. The error occurs when using strings in the actual class on the iOS platform (iosMain).

Cannot access 'dev.icerock.moko.resources.ResourceContainer' which is a supertype of 
'id.example.common.resources.FeederRes.strings'. 
Check your module classpath for missing or conflicting dependencies

Project Structure: -shared --common ---resource --core

Example Code:

Common (expect):

expect class CSVGenerate {
fun generateBody()
}
fun getMyFormatDesc(input: String): StringDesc {
    return StringDesc.ResourceFormatted(MR.strings.my_string_formatted, input)
}

iOS (actual):

actual class CSVGenerate {
actual fun generateBody() {
val string = getMyFormatDesc(input: "hello").localized()
}
}

Android (actual):

actual class CSVGenerate {
actual fun generateBody() {
val string = getMyFormatDesc("hello").toString(context = this)
}

Note: This error was encountered during a rebuild in Android Studio, but the project still runs when executed on Android and iOS.

Alex009 commented 2 weeks ago

hi. can you create small reproducer project?

Egi10 commented 1 week ago

I've tried replicating the issue by creating a sample project, but the same error doesn't occur.

Previously, I was using version 0.23.0 and everything was working smoothly. When the latest version came out and I wanted to upgrade Kotlin, I tried to update. However, I encountered the error.

Egi10 commented 1 week ago

I haven't encountered this issue before, but my project is not working properly. For now, I have downgraded to version 0.23.0 and implemented the solution from https://github.com/icerockdev/moko-resources/issues.