moko-resources icon indicating copy to clipboard operation
moko-resources copied to clipboard

Expected object 'SharedRes' has no actual declaration in module <composeApp_debug> for JVM

Open pankaj1920 opened this issue 1 year ago • 6 comments

Expected object 'SharedRes' has no actual declaration in module <composeApp_debug> for JVM

pankaj1920 avatar Nov 26 '23 09:11 pankaj1920

sourceSets {
    getByName("main").java.srcDirs("build/generated/moko/androidMain/src")
}

after adding this it is working but localization is not changing realtime as i change the device language from setting. i have to close app and reopen then it is working

pankaj1920 avatar Nov 26 '23 14:11 pankaj1920

I'm seeing a similar problem with multiplatform. The work around was:

    sourceSets {
        getByName("androidMain") {
            kotlin.srcDir("build/generated/moko/androidMain/src")
        }
    }

ScottPierce avatar Dec 02 '23 02:12 ScottPierce

Thank for the solution this have solve my problems too :) ✅

I think we can close this ticket ❌

Dardev12 avatar Dec 08 '23 22:12 Dardev12

Thank for the solution this have solve my problems too :) ✅

I think we can close this ticket ❌

I don't think so. This should be fixed in the plugin. The workaround shouldn't be necessary.

ScottPierce avatar Dec 08 '23 22:12 ScottPierce

I'm also seeing this issue. Thanks for the workaround @ScottPierce. I agree this should have a proper fix

Bradleycorn avatar Dec 14 '23 12:12 Bradleycorn

fix in #575

Alex009 avatar Jan 14 '24 14:01 Alex009

Alex009

fix in https://github.com/icerockdev/moko-resources/pull/575

Don't think it's fixed because I have similar error message on 0.24.0-alpha-5:

Expected object 'MR' has no actual declaration in module <common> for JVM

In my case I have android, common, desktop source sets. On Desktop build I see this error, Android build works fine. desktopMain directory is not created at all in common/build/generated/moko. So workaround with srcSet will not work because of this.

avently avatar Mar 25 '24 09:03 avently

@avently please preapre reproducer, because in our samples all works

Alex009 avatar Mar 25 '24 12:03 Alex009

Oh, I made a sample and after that noticed that I use dev.icerock.moko:resources-compose:0.24.0-alpha-5 but classpath("dev.icerock.moko:resources-generator:0.23.0"). So it's completely my fault, sorry. When I specified here the latest alpha and restructured project (from resources/MR to moko-resources) I see successful build for both platforms.

Also found how to fix desktop project build in 0.23.0:

applyDefaultHierarchyTemplate()

before sourceSets{}` in common gradle module. And this fixes Android build:

val androidMain by getting {
      kotlin.srcDir("build/generated/moko/androidMain/src")
...
}

avently avatar Mar 25 '24 14:03 avently

will be fixed in 0.24.0, please check in 0.24.0-alpha-6

ExNDY avatar Apr 17 '24 05:04 ExNDY

should be fixed in 0.24.0-beta-1

Alex009 avatar Apr 19 '24 14:04 Alex009