Dave Westerman
Dave Westerman

Reputation: 211

Jetpack Compose Preview Render Issues with IntelliJ Not Showing the Problems

I am doing Android Native programming with Jetpack Compose, using the latest version of IntelliJ.

When trying to do a Preview of my Composable, after some recent changes, I am getting an error in the Preview window: "Some issues were found while trying to render this preview".

enter image description here

When I click on the "Render Issues" button at the top of the Preview window, it shows me a popup that includes a link "View Problems".

enter image description here

The problem is that this link does absolutely nothing. It doesn't show me anything, so I have no idea what my render issues are.

Any ideas how I can actually see what the problems are with my preview? The preview was working before my latest changes. I obviously broke something, but I don't know what, since I can't see what the errors are.

UPDATE:

I still haven't figured out why I'm not seeing the errors when I click on the link, but I was able to find the errors in the IntelliJ log file, which is on my Mac in the following directory: ~/Library/Logs/JetBrains/IdeaIC2023.2/idea.log

My actual problem was that I needed to get application context, which I was storing in my main app file.

Upvotes: 2

Views: 2154

Answers (2)

multistackdeveloper
multistackdeveloper

Reputation: 63

Methinks it's a bug in android plugin, also present in latest Android Studio, I reported it to Google, give it +1

If anyone needs workaround, that will show you compose issues in realtime...

GNU Linux

cd ~/.cache/Google/AndroidStudio2024.2/log
tail -F idea.log | sed -uE 's;^202[45];\x0\n\0;' | grep --line-buffered -nozP '\n202[45].+?#com.android.tools.idea.uibuilder.scene.LayoutlibSceneRenderer(.|\n)+$'

Windows WSL same with another path (untested)

cd "$(cmd.exe /c "echo %LOCALAPPDATA%" | tr -d "\r")/Google/AndroidStudio2024.2/log"
tail -F idea.log | sed -uE 's;^202[45];\x0\n\0;' | grep --line-buffered -nozP '\n202[45].+?#com.android.tools.idea.uibuilder.scene.LayoutlibSceneRenderer(.|\n)+$'

Mac OS same with gsed in ggrep (untested)

cd ~/Library/Logs/Google/AndroidStudio2024.2/idea.log
tail -F idea.log | gsed -uE 's;^202[45];\x0\n\0;' | ggrep --line-buffered -nozP '\n202[45].+?#com.android.tools.idea.uibuilder.scene.LayoutlibSceneRenderer(.|\n)+$'

As new errors emerge, you'll see them

note that Google/AndroidStudio2024.2 is your IDE, change if you use or another version or IDEA like Dave Westerman.

P.S. If you want only first 57 lines to fit your terminal, grep expression can be

'\n202[45].+?#com.android.tools.idea.uibuilder.scene.LayoutlibSceneRenderer[^\n]+\n(?:[^\n]+\n){0,57}'

P.P.S. Use IDEA/Studio terminal and references in stacktrace will be clickable

Upvotes: 3

Erdal G.
Erdal G.

Reputation: 3000

Simply click on the warning icon here 👇

Click on the warning icon on the Preview block (not on the top right one)

The one on the Preview Block, not the one on the top right.

Upvotes: 0

Related Questions