moko-resources
moko-resources copied to clipboard
"Expected object 'MR' has no actual declaration in module <shared_debug> for JVM" (sample project included)
Hello,
I am trying to use moko-resources v0.23.0 to be able to use "shared" strings in a compose multiplatform project but I encounter the error in the title of this issue when trying to build the application.
The project and moko setup I am using can be seen here - https://github.com/Mugurell/KaMPKit/commit/e628563a547bb47635595939429093adb1dcab43
Additionally if I ask moko to build resources I get:
> ./gradlew clean
> ./gradlew generateMRcommonMain --info
Task ':shared:generateMRcommonMain' is not up-to-date because:
Output property 'outputDirectory' file /Users/petru/Projects/Tests/KaMPKit/shared/build/generated/moko/commonMain/src/co has been removed.
Output property 'outputDirectory' file /Users/petru/Projects/Tests/KaMPKit/shared/build/generated/moko/commonMain/src/co/touchlab has been removed.
Output property 'outputDirectory' file /Users/petru/Projects/Tests/KaMPKit/shared/build/generated/moko/commonMain/src/co/touchlab/kampkit has been removed.
file or directory '/Users/petru/Projects/Tests/KaMPKit/shared/build/generated/moko/commonMain/res', not found
file or directory '/Users/petru/Projects/Tests/KaMPKit/shared/build/generated/moko/commonMain/res', not found
file or directory '/Users/petru/Projects/Tests/KaMPKit/shared/build/generated/moko/commonMain/res', not found
file or directory '/Users/petru/Projects/Tests/KaMPKit/shared/build/generated/moko/commonMain/res', not found
file or directory '/Users/petru/Projects/Tests/KaMPKit/shared/build/generated/moko/commonMain/res', not found
file or directory '/Users/petru/Projects/Tests/KaMPKit/shared/build/generated/moko/commonMain/res', not found
file or directory '/Users/petru/Projects/Tests/KaMPKit/shared/build/generated/moko/commonMain/res', not found
with the expect class constructed
but not also with the actual ones
i just encountered this issue when upgrading my project's AGP to 8.2.0-alpha13 and kotlin to 1.9.0, it was working before. i was wondering if the kotlin update broke it but i see that you are using 1.8.22 🤔
Had the same issue recently after i added string resources to the 3rd module in project. Even git rollback to the point where everything was ok didn't help =))
The only solution i found is ./gradlew clean and completely delete $USER_HOME/.gradle folder.
i just tried cleaning the project, invalidating caches and purging $USER_HOME/.gradle but that didn't work, unfortunately.
in my case rolling kotlin back to 1.8.22 seems to prevent the error though 🤔
edit: it looks like it's a known issue https://github.com/icerockdev/moko-resources/issues/510
I think this's continuation of problem (or its variant): https://github.com/icerockdev/moko-resources/issues/353#issuecomment-1179713713 Worked solution: https://github.com/icerockdev/moko-resources/issues/510#issuecomment-1619141070 Tested on AGP: 8.0.1, Gradle: 8.2.1, Kotlin 1.9.0
Thank you! Was trying various mix and matches of kotlin, agp and gradle but seems to indeed be just a linking issue that hopefully will get fixed in the next versions.
issue will be fixed so we should not close this issue now :)
I just struggled this problem, and resolved by cleaning .gradle and using kotlin 1.8.22.
thanks!!!!!
For me the fix was to add dependsOn(commonMain) in androidMain source set
i just encountered this issue when upgrading my project's AGP to
8.2.0-alpha13and kotlin to1.9.0, it was working before. i was wondering if the kotlin update broke it but i see that you are using1.8.22🤔
This issue is due to kotlin plugin 1.9.0. But maybe another plugin(such as com.arkivanov.parcelize.darwin 0.2.0) has used the 1.9.0 version, the higher version has the priority. Y
Is this fixed on the moko-resources side?
I'm with the Compose-Multiplatform team, trying to understand whether this is the same issue reported here and whether any action on our part is required.
In here, after adding a dependsOn(commonMain) to androidMain source set, my errors disappeared.
I'm getting this issue with a fresh CMP template with kotlin 1.9.21. dependsOn is no longer with the new Gradle setup so instead I've tried
androidMain.dependencies {
implementation(project(":shared"))
Although this doesn't seem to work ... Any ideas?
I'm getting this issue with a fresh CMP template with kotlin 1.9.21. dependsOn is no longer with the new Gradle setup so instead I've tried
androidMain.dependencies { implementation(project(":shared"))Although this doesn't seem to work ... Any ideas?
@maitriyogin adding this line worked for me
androidMain {
dependsOn(commonMain.get())
}
@maitriyogin adding this line worked for me
androidMain { dependsOn(commonMain.get()) }
Thanks after adding dependsOn(commonMain.get()) android build is running fine but it introduces errors with ios. if i comment the 'dependsOn' line and sync ios build works fine but the issue in op comes back on android.
@maitriyogin adding this line worked for me
androidMain { dependsOn(commonMain.get()) }Thanks after adding
dependsOn(commonMain.get())android build is running fine but it introduces errors with ios. if i comment the 'dependsOn' line and sync ios build works fine but the issue in op comes back on android.
I got the same issue after adding dependsOn(commonMain.get()), iosMain not working
@maitriyogin adding this line worked for me
androidMain { dependsOn(commonMain.get()) }Thanks after adding
dependsOn(commonMain.get())android build is running fine but it introduces errors with ios. if i comment the 'dependsOn' line and sync ios build works fine but the issue in op comes back on android.I got the same issue after adding
dependsOn(commonMain.get()), iosMain not working
Same here :(
kotlin = "1.9.23" moko = "0.23.0" compose = "1.6.1" ....
worked for me:
androidMain {
dependsOn(commonMain)
}
will be fixed in 0.24.0, please check in 0.24.0-alpha-6
should be fixed in 0.24.0-beta-1