BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage News New in Android Studio 2.0: Instant Run and Cloud Test Lab

New in Android Studio 2.0: Instant Run and Cloud Test Lab

Leia em Português

This item in japanese

Android Studio 2.0 comes with several new features and improvements: Instant Run, integration with a Google service for testing on real devices, faster emulator, faster builds, GPU profiler and debugger, support for deep linking and others.

Being built on the latest IntelliJ IDEA 2016.1, Android Studio 2.0 has been recently made available to developers. We detailed some of the new features in Android Studio 2.0 when it hit the canary channel almost 6 months ago, so we won’t repeat that post here, focusing now on what is new or improved.

Android Studio 2.0 uses the latest stable Android platform and APIs, but it does not include support for Android N Developer Preview, which requires Studio 2.1 Preview. Installing the tools for Android N development require some manual work and details can be found on Set up the Preview page.

One of the interesting features in Android Studio 2.0 is Instant Run. After the first deployment of an application either on a real device or an emulator, Instant Run pushes most code or resource changes without building a new APK. Android Studio does that using one of the three types code swapping:

  • Hot Swap – this is the fastest approach without reinitializing objects in the running application. In some cases, the activity affected is automatically restarted. Hot swap is used when the content of an existing method changes.
  • Warm Swap – This requires the restart of the current activity and an image flicker may be noticed. The application is not restarted. Used when a resource changes or it is removed.
  • Cold Swap – Requires application restart. A new APK is still not created. Used for a longer list of edits including adding/removing/changing of annotations, instance fields, static fields, signature of static methods, parent class, the list of implemented interfaces, and others.

A new APK is built and deployed when editing the manifest. Instant Run is not available when deploying simultaneously to multiple devices because it uses different techniques for swapping on various API levels.

Another new feature in Android Studio 2.0 is integration with Cloud Test Lab Beta, a Google service providing the possibility of testing an Android application on real devices running in Google’s datacenters. Developers can write their own tests using Espresso, UI Automator 2.0, or Robotium. If no test is created, Google will still run Robo Test, a set of basic tests that attempt to see if the application crashes. Robo Test simulates user activity, going through the interface and performing various tasks. A video of the automated simulation is recorded. Also, tests can be instrumented to take screenshots at various moments during testing. The resulting logs, videos or screenshots are made available through the Developer Console. At this point the Cloud Test Lab service is provided at no charge. The wording on their pricing page suggests that Google will charge for it in the future.

Rate this Article

Adoption
Style

BT