-
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
Compose resources don't work in the Android Studio Preview #4476
Comments
At the moment you can use the Fleet it supports common previews: https://blog.jetbrains.com/fleet/2024/02/fleet-1-31-improved-markdown-experience-additional-run-configuration-macros-support-for-vitest-and-more/ |
This didn't resolve any issue |
This should not be closed until it works in android studio. Or at least we should have a bug on Android studio about it |
This is 3party problem. We will not fix it. So, I closed the issue. |
I believe this is the right issue to track: https://youtrack.jetbrains.com/issue/FL-25048 |
@terrakok , isn't this repository also for the IntelliJ plugin? If yes this issue would still be valid, no? |
Do you mean the compose IntelliJ plugin? It works for desktop java previews, I guess. |
Yes. And how about compose multiplatform preview annotations, not the desktop annotation workaround? |
It is supported in the Fleet only |
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 ## Release Notes ### Features - Resources - Android Studio Preview works with Compose Multiplatform resources now - Compose Multiplatform resources are stored in the android assets now. This fixes such cases as a rendering resource files in WebViews or Media Players
Please check the following ticket on YouTrack for follow-ups to this issue. GitHub issues will be closed in the coming weeks. |
This bug only appears in Android, but since it is related to multi-platform resources and the exception comes from
org.jetbrains.compose.resources
, I create a report hereDescribe the bug
Unable to use Android live preview for Composable functions that use multi-platform resources.
In a Compose multi-platform project, I am able to use android live preview for composable functions that do not use multi-platform resources.
But when the composable function use multi-platform resources, the preview rendering will report an error
Affected platforms
Versions
Android Studio Versions
Android Studio Hedgehog | 2023.1.1 Patch 2
Build #AI-231.9392.1.2311.11330709, built on January 19, 2024
Runtime version: 17.0.7+0-b2043.56-10550314 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Windows 11.0
Non-Bundled Plugins:
com.jetbrains.kmm (0.8.2(231)-25)
org.jetbrains.compose.desktop.ide (1.6.0)
To Reproduce
Steps and/or the code snippet to reproduce the behavior:
build.gradle.kts
undercomposeApp
Android
block:to enable android real-time preview
4. gradle sync
5. go to commonMain/kotlin/App.kt
6. Change
to
so that the image can be displayed by default
8. go to androidMain/kotlin/packagename/MainActivity.kt
9. open preview window
10. click Build & Refresh
11. You will see "Render problem"
Expected behavior
The preview will render normally and the Composable UI can be seen
Screenshots

Additional context
Rendering problem stack information:
The text was updated successfully, but these errors were encountered: