2

I'm working on a Compose Multiplatform project (CMP) with multiple feature modules. Each feature module contains a composeResources folder with drawable and values (strings,...) inside.

The issue is that some strings or icons are shared across multiple features, but CMP currently requires resources to be placed inside each module’s composeResources directory. This leads to duplicated resources, for example:

Feature: Home

string name="feature_home_hi">hi</string>

Feature: Account

<string name="feature_account_hi">hi</string>

Feature: Profile

<string name="feature_profile_hi">hi</string>

The same duplicated situation happens with icons as well. Because these assets are repeated across 3+ modules, the APK size grows unnecessarily.

❓ Question:

What is the best practice in Compose Multiplatform to avoid duplicating common resources (strings and drawables) across feature modules?

Is there a recommended approach such as:

  • A shared resource module?
  • A common resources bundle?
  • Using Gradle source sets in a shared module?
  • Or any CMP-specific way to reference resources without duplicating files?

Thanks in advance!

1 Answer 1

0

:core:ui-resources └── composeResources ├── values/strings.xml ├── drawable/ic_logo.xml ├── font/... └── ... etc. :feature:home :feature:account :feature:profile

Yes — the recommended approach in Compose Multiplatform is to create a shared resource module (or "common resources" module) and put all reusable resources there.

New contributor
Manish Kumar Tiwari is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
Sign up to request clarification or add additional context in comments.

1 Comment

As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.