-
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
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: ![](https://private-user-images.githubusercontent.com/3532155/341182790-ef26b667-ad0d-4efd-b7f9-23cff92ab49d.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTg4Nzg0MTgsIm5iZiI6MTcxODg3ODExOCwicGF0aCI6Ii8zNTMyMTU1LzM0MTE4Mjc5MC1lZjI2YjY2Ny1hZDBkLTRlZmQtYjdmOS0yM2NmZjkyYWI0OWQucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDYyMCUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDA2MjBUMTAwODM4WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9OTY1MzdhMTAxMjNmZDRhMDA4ZjdjODBjYzg3M2MyNDg0ZTA5OWFkZGZkZjk1ZDUwOWFkZDk3MmQ2YjIzNzJiYiZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ.xgUAr_2--ZHo6txhdAANRbe8ju2SQ5EACvK96gaGJnY) 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
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
![{5B5F991D-3FB0-483f-99B9-5475A0C1D9C6}](https://private-user-images.githubusercontent.com/52946163/312314817-6ff91059-ce07-4335-b22d-0224c475ecdd.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQ0NjcyOTIsIm5iZiI6MTcyNDQ2Njk5MiwicGF0aCI6Ii81Mjk0NjE2My8zMTIzMTQ4MTctNmZmOTEwNTktY2UwNy00MzM1LWIyMmQtMDIyNGM0NzVlY2RkLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MjQlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODI0VDAyMzYzMlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWVmNTFhZDE2ZjMyMWQ2MWZmYjJkYjgxMmQxODY5MzllZWE4ZWY2MzZjYTBjNmZjYzU2ZjJhOTQ1MmIwNzVkODEmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.DkNWQJzxbbGdkOAkBQ9MGqBRGKgxuqvYIM1VDOTBUCg)
Additional context
Rendering problem stack information:
The text was updated successfully, but these errors were encountered: