run app vs apply changes android studio 2.3

Prabs picture Prabs · Apr 19, 2017 · Viewed 10.7k times · Source

What is the major difference between

Run app and Apply changes?

enter image description here

What could be the best scenario to use each?

Thanks.

Answer

Amit Vaghela picture Amit Vaghela · Apr 19, 2017

"Apply changes" will be enabled if you have "instant run" enabled and to disable instant run check https://stackoverflow.com/a/35169716/2826147

From the Android documentation: https://developer.android.com/studio/run/index.html

Apply Changes button provides a faster workflow for most incremental changes to your app. [...]

You can clickApply Changes to push certain code and resource changes to your running app without building a new APK—and, in some cases, without even restarting the current activity. [...]

Clicking Run (or Debug ) forces a cold swap and an app restart. If you make a change to the app manifest or a resource referenced by the manifest, Android Studio always pushes your changes with a full APK reinstall. [...]

Apply Changes action is available only when you meet the following conditions:

  • Build your app using a debug build variant.
  • Use Android plugin for Gradle version 2.3.0 or higher.
  • Set minSdkVersion to 15 or higher in your app's module-level build.gradle file.
  • Deploy your app to a target device running Android 5.0 (API level 21) and higher.