faiziii
faiziii

Reputation: 381

Android Studio does not reflect my xml changes

When I do any changes in xml layout file, it doesn't reflect with new compilation build although R.java is generated but when I run the application changes doesn't reflect. I need to rebuild the whole project which is taking time. Any help on this?

I guess before it was working fine.

Upvotes: 1

Views: 6800

Answers (6)

Svetoslav Stoyanov
Svetoslav Stoyanov

Reputation: 146

After a few days of fighting this issue, I solved it by deleting all "v26" directories inside the "res" directory, since the activity was using it instead of the usual "layout" directory for accessing the xml.

app/src/main/res/layout-v26/ had to be deleted and you should remain only with app/src/main/res/layout/

Anyway, I am new to android development and am not sure if this can lead to other issues, so be careful.

Upvotes: 2

Yasser AKBBACH
Yasser AKBBACH

Reputation: 1038

You can simply switch to project view and remove the build of the app:

enter image description here

Upvotes: 0

Harry Mitchell
Harry Mitchell

Reputation: 1130

This sounds similar to my situation. I had an extra quote character in my colors.xml file, which caused errors when I tried to run my app. What worked for me was to remove the extra quote in my colors.xml file. Then I saved the file. Then I restarted Android Studio.

Upvotes: 0

user6627139
user6627139

Reputation: 416

I "touch" AndroidManifest.xml and that forces a build. Does not take nearly as long as rebuilding project or restarting emulator. It's a hack, but hey, it's my hack.

Upvotes: 0

ghost talker
ghost talker

Reputation: 392

Yes Sometimes it also happens to me. If you are doing changes i right way in the Xml file then those must be appear when you run your app. But if it does not happen, then you need to rebult your application, or clean it several time. if it also does not work to you then do the follwoing :

  1. Close and re-open (Restart) the android studio and try running app again.
  2. If step 1 is also not helpful then Uninstall app from your device , Disconnect and connect device again and rebuilt/Run app directly in your device again.

I hope this will work for you.

Upvotes: 2

ChiHang
ChiHang

Reputation: 136

Pleas check if you have enabled Power save mode (File -> Power Save Mode) which turn off auto compilation

Android Studio - Auto complete and other features not working

Upvotes: 0

Related Questions