icerockdev / moko-resources

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

resource are not generating properly #511

Open sunildhiman90 opened 1 year ago

sunildhiman90 commented 1 year ago

Hi, in my project, resources are not generating. Not able to use strings with MR.strings Similarily for all other resources, it show MR.directory_name, but not any resource is accesible And for strings, it does not show even strings with MR, like this: MR.strings, not available

Reproducer: You can checkout given repo, and select with-moko-resources-library branch https://github.com/sunildhiman90/compose-multiplatform-template-with-navigation

I have attached screenshot as well for quick reference for project resources structure with moko resources. But you can check whole project at the link mentioned in reproducer.

Screenshot 2023-06-06 at 10 31 38 AM

Thanks.

Alex009 commented 1 year ago

hi! did you call generateMRcommonMain task after changes of resources directory? i clone your repo and all works fine as i see.

image
sunildhiman90 commented 1 year ago

oh, i thought only gradle sync would be enough thats why i didnt tried generateMRcommonMain as it was mentioned either gradle sync or run this task to generate MR resource,

Thanku, i will try generateMRcommonMain

Alex009 commented 1 year ago

yes, you can use gradle sync or gradle task. you do gradle sync after resources dir changes or before?

sunildhiman90 commented 1 year ago

I did sync after resources dir changes, But it didnt updated, ANd one more thing, now i tried using ./gradlew generateMRcommonMain, But still its not producing resoruces, Am i still missing anything? But as you also checked that branch, it worked for you ,So what can be the issue from my side? any idea?

Alex009 commented 1 year ago

maybe you expect something wrong? what exactly you expect from ./gradlew generateMRcommonMain run? also try to run ./gradlew generateMRcommonMain --info and attach logs here

sunildhiman90 commented 1 year ago

Hi, i have attached the logs file of ./gradlew generateMRcommonMain --info

logs (1).docx

harsh2907 commented 1 year ago

Hey Alex, may i know the name of the theme you use in android studio

malliaridis commented 1 year ago

@sunildhiman90 can you try setting the JVM version to 11, clean cache and rebuild the project? I had to set the Gradle JVM to 11 (in the IDE settings) as well as the Android targetCompatibilty and sourceCompatibilty in the android.compileOptions to JavaVersion.VERSION_11, then it worked.

The Gradle JVM is the only thing that is not version-controlled and probably the reason why it worked for Alex.

@harsh2907 It's the New UI of the JetBrains IDEs. I am not sure if it is already available for Android Studio, but all the other IDEs of JetBrains have this UI now.

tassilo-posegga commented 8 months ago

Same issue after trying to rename package names after using the KMP Compose Template. Resources are not generated with the new package defined

multiplatformResources {
    multiplatformResourcesPackage = "foo.bar"
}
Alex009 commented 8 months ago

@tassilo-posegga did you use 0.24.0 alpha 5 version?