-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
@terrakok Do you have any update about this? What step we have to follow to solve the issue? Thanks |
It's mentioned here: https://github.com/JetBrains/compose-multiplatform/releases/tag/v1.7.0-alpha01 |
Should this have also resolved https://issuetracker.google.com/issues/345275143? I did quick test and it didn't seem to but I might have missed something. |
Demo ImageResPreview doesn't seem to work and gives error: |
Found the root cause: |
Hello everyone, is this feature only available for projects that have a shared folder? I tested it on my project that uses composeApp/commonMain and it didn't work. I'm using Android Studio Koala version 2024.1.1 |
I am trying to get the preview feature work on my android studio but i am not even being able to see the icons for preview |
Android Studio preview works in the android source set only |
Okay so can you guide me on how to set that up or provide any guide to it |
just wait the official release 1.7.0 with proper documentation |
@Varun-Sethi-Dev You can reference any composable from commonMain in your androidMain sourceSet. Just make sure to use the following dependencies in your androidMain and to set buildFeatures.compose = true. androidx-ui-tooling = { group = "androidx.compose.ui", name = "ui-tooling", version.ref = "androidx-compose" } Note: I am using Android Studio Ladybug | 2024.1.3 Canary 3 |
This is probably user error, but... Lets say I save an MP3 in my shared Compose Resources:
and then I get the url:
And the result is so:
Is that an intended behavior? I ask because I'm not able to find files there. |
File an issue on the youtrack, please |
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
Highlights - Resources