Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Compose preview "Render problem" with API 34 and Compose UI 1.5.0

I recently started a new app using Compose. I have AS Hedgehog 2023.1.1 installed. I am using API 34 and get an error in the compose preview. "Render problem" accompanied by a

Layout fidelity warning

The graphics preview in the layout editor may not be accurate: 
    - The current rendering only supports APIs up to 33. You may encounter crashes if using with higher APIs. To avoid, you can set a lower API for your preview.

How do I set a lower API for previews?

Googling I only find results telling me to drop the API level of the entire app, OR answers from 2 years ago pointing to using a very old version of compose.

like image 894
dan Avatar asked Feb 05 '26 05:02

dan


1 Answers

Use @Preview(apiLevel = 33), like below

@Preview(apiLevel = 33)
@Composable
fun YourComposablePreview() {
    ...
}
like image 118
Kai Avatar answered Feb 07 '26 21:02

Kai



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!