-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Pack all resources to assets on the android target. #4965
Conversation
I might be wrong here, but it looks like it might lead to fixing android previews with multiplatform resources (#4932, #4476) eventually... If CopyResourcesToAndroidAssetsTask is run before whatewer Android Studio does to render previews and AndroidContextProvider.ANDROID_CONTEXT is set somehow from the preview (or ContextLocal is used instead) |
I checked a preview with the new packaging but it doesn't work because android assets is semi available in the preview mode. It works strange for a regular android project too:
UPDATE: the problem is addGeneratedSourceDirectory function doesn't work with AS Compose Preview |
...ces/library/src/androidMain/kotlin/org/jetbrains/compose/resources/ResourceReader.android.kt
Outdated
Show resolved
Hide resolved
gradle-plugins/compose/src/main/kotlin/org/jetbrains/compose/resources/AndroidResources.kt
Show resolved
Hide resolved
...lugins/compose/src/test/kotlin/org/jetbrains/compose/test/tests/integration/ResourcesTest.kt
Show resolved
Hide resolved
components/resources/library/src/androidMain/AndroidManifest.xml
Outdated
Show resolved
Hide resolved
…roid resource reader.
...ces/library/src/androidMain/kotlin/org/jetbrains/compose/resources/AndroidContextProvider.kt
Show resolved
Hide resolved
6140e1b
to
3d6788a
Compare
The PR changes the android resources packaging. Now all resources are packed to the android assets (not only fonts). It unblocks usage android URIs to the resources in a WebView or other external resource consumers.
Additionally the PR fixes Android Studio Compose Previews work with multiplatform resources:
For a backward compatibility the resources library tries to read resources in java resources if assets were not found.
Fixes #4877
Fixes #4503
Fixes #4932
Fixes #4476
Fixes #3828
Release Notes
Features - Resources