I've being trying to use resources from my commonR...
# multiplatform
r
I've being trying to use resources from my commonResources directory and I'm still having problems. As soon I move the Strings.xml file to the composeResources I'm receiving an error from the Manifest because of AppName. I already followed the official documentation about config on build.gradle clean and rebuild. Still receiving error.
Copy code
* What went wrong:
Execution failed for task ':composeApp:processDebugResources'.
> A failure occurred while executing com.android.build.gradle.internal.res.LinkApplicationAndroidResourcesTask$TaskAction
   > Android resource linking failed
     ERROR: /Users/rafamsilva/AndroidStudioProjects/Forgo/composeApp/src/androidMain/AndroidManifest.xml:4:5-22:19: AAPT: error: resource string/app_name (aka com.feeltheboard.forgo:string/app_name) not found.
Anyone?
c
I think for now, you can just remove the
android:label
attribute to fix the build issue. It’s possible to access the resources declared in
commonMain
from
androidMain
in code but I haven’t tried myself accessing the resources in xml file for eg: on manifest.xml. For other use cases, I think this doc should help: https://www.jetbrains.com/help/kotlin-multiplatform-dev/compose-multiplatform-resources-usage.html#strings
r
Yeah, i Can just hardwrite there the name of the app. I was trying to understand why was not building the resources. I removed the strings.xml from the androidMain and added on to composeResources. Everytime you add resources, rebuild still necessary. Which makes sense.. Another tool that is gone is adding string resources directly from a composable to the string.xml. Thanks for the reply.
c
yeah, it looks like rebuild is necessary to regenerate resources. I was hoping there was a gradle task for it. Adding resources directly from compose/xml to strings.xml is android only feature. You can still do that I guess but only for
androidMain
source set. Hopefully, we will get these features later for multiplatform.