Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Studio not deploying changes to app

Sometimes this scenario occurs when developing. I would make a change in my source code, hit save all and then run but the change wouldn't be apparently not reflected in the app -(I'm using a device for testing). I can even uninstall the app on my device, and hit run again and the newly installed app still hasn't reflected the change in the source code. When this happens I have to edit the source, hit run and maybe then a new version with the changes I expected will be on the device.

I also tried the solution here, but it doesn't seem to work often.

Android Studio - Deploys my app without new changes

like image 689
Simply Brian Avatar asked Mar 28 '15 02:03

Simply Brian


4 Answers

EDIT2 (2020-03-09)

If you are using gradle 6.0 in your gradle-wrapper.properties, you may also encounter a similar situation because there is this bug in 6.0 version. Try 6.0.1 instead.


Yesterday (2018-03-27) Android Studio published an official update from 3.0.1 to 3.1, and it looks like a lot of people (including me) start running into this issue again.

Credit to #5 comment here, below is how it solved:

In Android Studio, go to Run > Edit Configuration.

Under Before launch:, if you cannot find Gradle-aware Make, just like below:

enter image description here

Add Gradle-aware Make and leaving Task empty.

enter image description here

Warning: I don't know what these action means, and whether it will cause any side-effects. Appreciate if someone can give more explanation on it!

EDIT

Thanks to @ChristopherSmit referenced, this page mentions that Gradle-aware make means "Compile the project and run Gradle".
At first I guess this may make Runs take longer time even if no code has been changed; but after testing, the second time is still much faster if no code has been changed.
Given that fact that this is a default option if you create a new project using AS 3.1, I think this configuration is pretty safe.

like image 194
Sira Lam Avatar answered Nov 17 '22 03:11

Sira Lam


I've got the same problem. This thread popped up first when I've searched for it. Solved it (hoping so) by not using the Instant Run feature. Might not be the best solution but it works for now.

Just go to "File -> Settings -> Build, Execution, Deployement -> Instant Run" and just disable it. With this Android Studio builds from scratch each time but it's better than not building it right.

Mini rant: Almost each version of Android Studio comes with an annoying bug. They're about to release the version 2 but its beta is still buggy. I hope they stabilize the IDE in the near future.

like image 28
Göktay K. Avatar answered Nov 17 '22 02:11

Göktay K.


I had the same Problem, using Android Studio 2.0.0, solved it by rebuilding my Project.

Build > Rebuild Project

GUI Picture

or by Clean and Rerun

Run > Clean and Rerun

Clean and Rerun

like image 41
Rüdiger Avatar answered Nov 17 '22 01:11

Rüdiger


This was a real stumper until I realized that my changes must not be propagated to all relevant files ...

If you're having trouble with layouts, as I was, you may find that you need to update the layout in the res > layout-v17 folder. I had made changes via the Design View in the layout folder and those changes seemed to be propagated automatically to layout-v17, initially. However, later changes WEREN'T.

Check your res > layout-v17 folder and see if the .xml files in that folder reflect the changes you are seeing in your res > layout folder. You will probably find that they don't. Fix this and re-deploy. Like me, you should see the new code mods.

Hope this helps.

like image 12
Alek Slodowska Avatar answered Nov 17 '22 01:11

Alek Slodowska