Skip to content

upd: resources in androidLibrary #335

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

Merged
merged 2 commits into from
Apr 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion topics/compose/compose-multiplatform-resources-setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ To properly configure the project to use multiplatform resources:
3. Create additional directories for qualified resources (for example, different images for the dark UI theme
or localized strings).

## Dependency and directory setup
## Build script and directory setup

To access resources in your multiplatform projects, add the library dependency and organize files within your project directory:

Expand Down Expand Up @@ -79,6 +79,21 @@ compose.resources {
```
{initial-collapse-state="collapsed" collapsible="true" collapsed-title="directoryProvider = tasks.register<DownloadRemoteFiles>"}

### Resources in the `androidLibrary` target
<secondary-label ref="Experimental"/>

Starting with the Android Gradle plugin version 8.8.0, you can use the generated `Res` class
and resource accessors in the `androidLibrary` target.
To enable support for multiplatform resources in `androidLibrary`, update your configuration as follows:

```
kotlin {
androidLibrary {
experimentalProperties["android.experimental.kmp.enableAndroidResources"] = true
}
}
```

## Qualifiers

Sometimes, the same resource should be presented in different ways depending on the environment, such as locale,
Expand Down
1 change: 1 addition & 0 deletions topics/whats-new/whats-new-compose-180.md
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,7 @@ improving the overall experience of building and running applications on ARM-bas
## Gradle plugin

### Support for multiplatform resources in the `androidLibrary` target
<secondary-label ref="Experimental"/>

Starting with the Android Gradle plugin version 8.8.0, you can use generated assets in the new `androidLibrary` target.
To align Compose Multiplatform with these changes, we’ve introduced support for a new target configuration to work with
Expand Down