Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 254
Alex Chengalan Avatar asked Oct 09 '16 07:10

Alex Chengalan


3 Answers

If problem persist just follow these steps:

File> Invalid cache/Restart > Invalidate and Restart

It will then surely work.

like image 150
Anas Aijaz Avatar answered Nov 12 '22 07:11

Anas Aijaz


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.

like image 28
opznhaarlems Avatar answered Nov 12 '22 05:11

opznhaarlems


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.

enter image description here

like image 41
tarrball Avatar answered Nov 12 '22 07:11

tarrball