i have created 4 activities they all were work well but suddenly the preview of design in XML file is not showing I have tried to reopen my android studio also that specific XML. but the problem is still here.
XML code is showing but only the preview of design is not showing here the ss of screen.
please check and help me to solve this out.
Question posted in Android Studio
The official documentation can be found here.
The official documentation can be found here.
5
Answers
you just need to do invalidate Caches and restart, I have provided an image for you to know what to do exactly. in android studio, go to the top left corner and select file and click on Invalidate Caches/restart and that will restart your android studio. than try to open your xml layout.
Image
please try the following steps:
if still your problem is not solved then try to restart your computer
This is a log on StackOverFlow for those who continue to have problems after doing a clean build, invalidating caches and restarting, and restarting the computer.
Check if the element of the view has a custom view imported from an external library.
Ex.
In my case, I was using YouTubePlayerView of YouTubeAPI.
Obviously, the preview worked fine until Chipmunk.
However, the preview has not been released since Dolphin.
So I annotated the YouTube player view.
Then the preview was displayed normally.
In fact, I’ve confirmed that other people are experiencing the same problem as above.
So my guess is that custom views from libraries that are no longer updated as Gradle versions go up are not compatible with each other.
In that case
It seems to be a problem caused by using an external library view called de.hdodenhof.
enter image description here
I came to the solution of mia. She suggests to use
in the apps build.gradle.
This bug appeared initially to me with version
1.8.0
. Also tried unsuccessfully with versions1.8.0-alpha02
and1.9.0-beta01
.I have tried all the method from above, unfortunately, nothing work.
Upgrade to Android Studio Flamingo | 2022.2.1. fix the problem.
(from my experience, this issue occurred on Dolphin and Electric Eel. Before that, Chipmunk was fine)