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.
2
Answers
There seems to be a dropdown above the preview window allowing to select different API versions for preview. Selecting 33 or below from the list makes the warning go away.
The error message is misleading in most cases.
Check Build > "Render Problem" for getting exact underlying issue.
I was printing logs and logging them to Firebase, so for preview Firebase Initialisation was required. Removing that dependency resolved the issue.