6

I'm loving the Instant Run feature of Android Studio 2.0 so far. For little tweaks in the current activity it's great. However sometimes I need to make a tweak in an earlier activity and Instant Run either doesn't apply that change or maybe just doesn't rerun that previous activity. I'd like to be able to keep Instant Run as a quick option, but sometimes just want to tell AS to just reload the full app and not use Instant Run.

Is there a quick way to do this? I saw somewhere that there was a 3-step checklist to do it - Stop, Rebuild, Debug. But even that didn't seem to work and obviously was slower than the old method of pressing a single button.

Scott
  • 3,663
  • 8
  • 33
  • 56
  • 1
    Yep exactly, when you make bigger changes like changing method signatures instant run just tries to swap it and it can lead to ART exceptions. Docs just advice to stop the app and rebuild it which will install an apk http://tools.android.com/tech-docs/instant-run. However, that is slow and a simple non-instant run button from the old version would be faster. – headsvk Feb 13 '16 at 13:38
  • Clyde, you can use Build > Clean and Re-run in that case. Shift + Click on re-run icon will also do Clean and Re-run. – James L. Oct 19 '16 at 00:33

1 Answers1

7

This happens because your changed code was never run again, so it's not a bug per se.

In the stable version of Android Studio 2.0, we have added a re-run button enter image description here to the toolbar. If you click it, it will push your changes and restart your app, essentially forcing a cold swap. The restarted process would then have all the changes you want to see because all your new code will get run again.

Hope that helps!

James Lau
  • 169
  • 1
  • 4
  • 3
    In Studio 2.2 the re-run button restarts the app, but does not re-install the APK. I have changes in the code which are not getting pushed to the device. It's very frustrating because on a couple of occasions I have spent considerable time tearing my hair out because nothing I did seemed to solve a problem, only to realise that the APK was not being updated. – Clyde Sep 22 '16 at 05:53