New Things in Android Studio 2.0
Since two days ago Android Studio 2.0 is available as a stable release. Instant Run, a big faster builds and a new emulator. It also has a new cool looking website


What’s new:
- Instant Run — For every developer who loves faster build speeds. Make changes and see them appear live in your running app. With many build/run accelerations ranging from VM hot swapping to warm swapping app resources, Instant Run will save you time every day.
Introduced in Android Studio 2.0, Instant Run is a behavior for the Run and Debug commands that significantly reduces the time between updates to your app. Although your first build may take longer to complete, Instant Run pushes subsequent updates to your app without building a new APK, so changes are visible much more quickly.
About Instant Run
Introduced in Android Studio 2.0, Instant Run is a behavior for the Run and Debug commands that significantly reduces the time between updates to your app. Although your first build may take longer to complete, Instant Run pushes subsequent updates to your app without building a new APK, so changes are visible much more quickly.
Instant Run is supported only when you deploy the debug build variant, use Android Plugin for Gradle version 2.0.0 or higher, and set minSdkVersion to 15 or higher in your app’s module-level build.gradle file. For the best performance, set minSdkVersion to 21 or higher.
After deploying an app, a small, yellow thunderbolt icon appears within the Run button (or Debug button), indicating that Instant Run is ready to push updates the next time you click the button. Instead of building a new APK, it pushes just those new changes and, in some cases, the app doesn’t even need to restart but immediately shows the effect of those code changes.
Instant Run pushes updated code and resources to your connected device or emulator by performing a hot swap, warm swap, or cold swap. It automatically determines the type of swap to perform based on the type of change you made. The following table describes how Instant Run behaves when you push certain code changes to a target device.
Code ChangeInstant Run Behavior
- Change implementation code of an existing method
Supported with hot swap: This is the fastest type of swap and makes changes visible much more quickly. Your application keeps running and a stub method with the new implementation is used the next time the method is called.
Hot swaps do not re-initialize objects in your running app. You may need to restart the current activity, or restart the app, before you see certain updates. By default, Android Studio automatically restarts the current activity after performing a hot swap. If you do not want this behavior, you can disable automatic activity restarts.
- Change or remove an existing resource
Supported with warm swap: This swap is still very fast, but Instant Run must restart the current activity when it pushes the changed resources to your app. Your app keeps running, but a small flicker may appear on the screen as the activity restarts — this is normal.Structural code changes, such as:
- Add, remove, or change:
- an annotation
- an instance field
- a static field
- a static method signature
- an instance method signature
- Change which parent class the current class inherits from
- Change the list of implemented interfaces
- Change a class’s static initializer
- Reorder layout elements that use dynamic resource IDs
Supported with cold swap (API level 21 or higher): This swap is a bit slower because, although a new APK is not required, Instant Run must restart the whole app when it pushes structural code changes.
For target devices running API level 20 or lower, Android Studio deploys a full APK.
- Change the app manifest
- Change resources reference by the app manifest
- Change an Android widget UI element (requires a Clean and Rerun)
When making changes to the app’s manifest or resources referenced by the manifest, Android Studio automatically deploys a new build in order to apply these changes. This is because certain information about the app, such as its name, app icon resources, and intent filters, are determined from the manifest when the APK is installed on the device.
If your build process automatically updates any part of the app manifest, such as automatically iterating versionCode orversionName, you will not be able to benefit from the full performance of Instant Run. We recommend that you disable automatic updates to any part in the app manifest in your debug build variants.
Note: If you need to restart your app after a crash, do not launch it from your target device. Restarting your app from your target device does not apply any of your code changes since the last cold swap or incremental build. To launch your app with all your recent changes, click Run or Debug from Android Studio.
Using Rerun
When pushing code changes that affect certain initializers, such as changes to an app’s onCreate() method, you need to restart your app for the changes to take effect. To perform an incremental build and restart the app, click Rerun
If you need to deploy a clean build, select Run > Clean and Rerun ‘app’
from the main menu, or hold down the Shift key while clicking Rerun
This action stops the running app, performs a full clean build, and deploys the new APK to your target device.
Disabling automatic activity restart
When performing a hot swap, your app keeps running but Android Studio automatically restarts the current activity. To disable this default setting:
- Open the Settings or Preferences dialog:
- On Windows or Linux, select File > Settings from the main menu.
- On Mac OSX, select Android Studio > Preferences from the main menu.
- Navigate to Build, Execution, Deployment > Instant Run.
- Uncheck the box next to Restart activity on code changes.
If automatic activity restart is disabled, you can manually restart the current activity from the menu bar by selecting Run >Restart Activity.
Configuring and optimizing your project for Instant Run
Android Studio enables Instant Run by default for projects built using Android Plugin for Gradle 2.0.0 and higher.
To update an existing project with the latest version of the plugin:
- Open the Settings or Preferences dialog.
- Navigate to Build, Execution, Deployment > Instant Run and click Update Project, as shown in figure 3.
- If the option to update the project does not appear, it’s already up-to-date with the latest Android Plugin for Gradle.

- Figure 3. Updating the Android Plugin for Gradle for an existing project.
You also need to change the build variant to a debug version of your app to start using Instant Run.
You also get a new emulator




Downside: It eats lots of RAM!