I tried fixing this for ages now, but I don't know what to do. How do I get it to display a preview? Here is a screenshot of the code:
I tried fixing this for ages now, but I don't know what to do. How do I get it to display a preview? Here is a screenshot of the code:
From Menu Open file option and choose option Close Project.
then restart your project android.
this will resolve your issue.
The attached screenshot shows your Project is not sync properly. Here are some of the possible steps:
Sync Project with Gradle Files for more Here is answer with more detail.rebuildOne of the above should fix the problem. If none of the above work try restarting IDE (Android Studio).
Close the android studio and reopen the project again. If not work replace all 'compile' with 'implementation' from build.gradle file. Because it is obsolete now and will be removed at the end of 2018. I solved this kind of problem like that.
I tried above answers. But, sometimes they work and sometimes not.
I tried -
File -> Invalidate Caches/ Restart -> Invalidate and restart
And it always works for me.
I do this to solved the problem:
type Ctrl + Shift + A to open the "Actions" search window
input "Sync Project with Gradle Files" , then type Enter
wait for Sync finished