'Android studio layout xml not updating
I am using Android Studio latest version and recently facing a problem that, my layout xml Design view not getting updated rapidly if I have changed background from selector resource or changed the image resource background. I found that Rebuild Project again updating the layout. But my project is little big and its taking some time to rebuild again. It would be nice if there is any other quick solution for this. I have also tried the Synchronize xml option, but not worked as expected. Please suggest me if there is any better option. Thanks.
Solution 1:[1]
If problem persist just follow these steps:
File> Invalid cache/Restart > Invalidate and Restart
It will then surely work.
Solution 2:[2]
Not sure when they added this but you can force the layout to refresh in the Design/Blueprint toggle menu (see below). This fixed the issue for me.
Solution 3:[3]
I had a similar issue. Mine ended up being caused by a duplicate layout file (in my case res/layout/activity_main.xml and res/layout-v21/activity_main.xml).
Turns out I enabled alternative resources for my layout, which created a copy of the layout for older API levels.
Reverting that change fixed it for me.
Solution 4:[4]
I was also struck in the same problem and the Temporary and working solution is to change the preview device. If you want you can also switch to the previous device. Layout will be updated.
Sorry for being Late
Solution 5:[5]
Solution 6:[6]
I guess changing the tabs will refresh the layout. Try this. Hope this helps.
Solution 7:[7]
one time colse that file and open it again may be its reflected your changes if its not work than one time run your app and after changes of of your xml file its reflected in preview.
Solution 8:[8]
I solved the problem by deleting the file ".flat" that matching the name of the xml file (for example, "activity_main.xml.flat").
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | jeffng50 |
| Solution 2 | tarrball |
| Solution 3 | opznhaarlems |
| Solution 4 | Daksh Agrawal |
| Solution 5 | Jason Aller |
| Solution 6 | Harv |
| Solution 7 | Kevan Aghera |
| Solution 8 | Yuriy |


