Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Component.Resources] :android:assembleDebug and :desktop:run raises error in a multi-module environment #4083

Closed
subroh0508 opened this issue Dec 30, 2023 · 2 comments
Assignees
Labels
bug Something isn't working enhancement New feature or request reproduced resources

Comments

@subroh0508
Copy link

Describe the bug
In a multi-module environment, Android and Desktop apps will fail to run if multiple strings.xml are placed for each module.

Stacktrace(Android)

> Task :android:mergeDebugJavaResource FAILED

Execution failed for task ':android:mergeDebugJavaResource'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.MergeJavaResWorkAction
   > 2 files found with path 'composeRes/values/strings.xml'.
     Adding a packagingOptions block may help, please refer to
     https://developer.android.com/reference/tools/gradle-api/8.2/com/android/build/api/dsl/ResourcesPackagingOptions
     for more information

...

Stacktrace(Desktop)

> Task :desktop:run
Exception in thread "main" java.lang.IllegalStateException: String ID=`module2_text` is not found!
	at org.jetbrains.compose.resources.StringResourcesKt.loadString(StringResources.kt:102)
	at org.jetbrains.compose.resources.StringResourcesKt.access$loadString(StringResources.kt:1)
	at org.jetbrains.compose.resources.StringResourcesKt$stringResource$str$3.invokeSuspend(StringResources.kt:77)
	at org.jetbrains.compose.resources.StringResourcesKt$stringResource$str$3.invoke(StringResources.kt)
	at org.jetbrains.compose.resources.StringResourcesKt$stringResource$str$3.invoke(StringResources.kt)
	at 
...

Affected platforms
Select one of the platforms below:

  • Android
  • Desktop

Versions

  • Kotlin version: 1.9.21
  • Compose Multiplatform version: 1.6.0-dev1350

To Reproduce
Clone this repository and run the command :android:assembleDebug or :desktop:run.

Expected behavior
Android and Desktop apps must run correctly.

@terrakok
Copy link
Collaborator

terrakok commented Jan 3, 2024

Yes. At the moment the compose resources doesn't support multimodule projects. It will be fixed in the future.

@terrakok
Copy link
Collaborator

#4454

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request reproduced resources
Projects
None yet
Development

No branches or pull requests

3 participants