4

Start of with, I tried all the suggestions in SO and none helped me.
Suggestion1,Suggestion2,Suggestion3.

I'm doing some debugging (Just running the app on my device through Android Studio) and I noticed that time after time, changes that I made in the app does not applied to the .apk AS is running.

The only solution I know is to delete the app from my device and then running again and it compiles with the changes I made in the code. Alternatively, I restart Android Studio and it fixes that too.

I try all suggestions on the site including: file -> invalidate Chaches / Restart -> invalidate, and changing my Run -> Edit Configuration settings but turned out unsuccesfully.I also read all the documentation here but It just repeats the answers here.

My Run -> Edit Configuration enter image description here

So what's up with Android Studio not applying my code changes?

EDIT:
So for now still no fix suggestion is working. Even my File -> Invalidate Caches / Restart -> Invalidate and Restart not working either.

Community
  • 1
  • 1
God
  • 1,238
  • 2
  • 18
  • 45

2 Answers2

3

There is a bug with the new Instant Run feature, the app is not reloaded correctly. You can disable Instant Run in File > Settings > Build, Execution, Deployment > Instant Run and uncheck the first checkbox. Now when you click the Run button, the app will be refreshed correctly.

God
  • 1,238
  • 2
  • 18
  • 45
Moussamoa
  • 417
  • 1
  • 4
  • 19
1

How do you deploy the changes in your app to the device? I used to do it by pressing the green triangle (the "play" button) which is the first on the right from the name of the app in the top toolbar. In the new AS version, when you make changes to your app, that button gets a small thunderbolt icon next to the green triangle, like here: The new AS toolbar

This new icon means that AS will try to do an "Instant Run", ie. to make a hot swap or a warm swap to your app as it is running. Sadly, this hasn't been working as advertised for me (I have been using the new AS for a week now). Instead, I go for the "ReRun selected configuration" button, the fifth on the right, with the gray square and the curved arrow in order to send the changed .apk to the device.

panonski
  • 555
  • 5
  • 10
  • Thanks for the answer but I'm not using the instant run feature (I always close the app entirely before I run it again and thus I don't have that lightning symbol). – God May 20 '16 at 07:54
  • I tried it your way right now... the lightning symbol did go away, but the Event Log still said "No changes to deploy" and indeed it did not deploy my changes. If it is not too much trouble, please try it with the other button and let me know if it worked. – panonski May 20 '16 at 08:01
  • As i wrote to @Moussamoa I will try your suggestions as soon as I will stumble again with the problem (For now I don't want to mess things up again) and I will update here and accept an answer. Thanks for your help mates :). – God May 20 '16 at 08:04
  • It happened again (So annoying), and I used the rerun button you suggested but it's still running the old `.apk` file. – God May 27 '16 at 05:29