Android Studio 2.0 Beta: What’s New?

An Android Tool Time Deep Dive Breakdown

Reto Meier
Google Developers
5 min readFeb 8, 2016

--

After 10 canary builds, Android Studio is now available in Beta! If you haven’t played with it since the canary launch at the Android Dev Summit, now’s a great time to take a fresh look.

Any time spent waiting for your IDE is time wasted. Time you could be writing code, time that pushes out the end of your day, or a break that risks dropping you out of the zone.

The goal for Android Studio 2.0: Make everything ten times faster. Faster builds, faster deployment, faster emulators. Everything. Faster. The internal codename was “10x”.

Instant Run

Instant Run builds and deploys incremental changes to your app within a few seconds by hot swapping code — injecting changes directly into your running app process.

The lightning bolt means Instant Run is enabled for your running app

Changed or added resources are also sent to the running app, with the affected Activity restarted to reflect those changes all within a few seconds.

Some code changes still require a full build (though the number of situations requiring a restart is shrinking as Instant Run evolves).

Instant Run works with all emulators (not just Google’s), and on almost every physical device — provided it’s running Ice Cream Sandwich or newer, which covers over 95% of active devices.

NOTE: If your dev device is running Gingerbread or Honeycomb, it might be time to consider investing in an upgrade.

Significantly Faster Full Builds

When you can’t use Instant Run, full build times are still more than two and half times faster, with Android Studio 2.0 improving each step of the full build and deploy process.

We’ve improved dx to use a quadratic algorithm to merge pre-dex’d files . It now also runs in process, and allows you to run up to 4 instances in parallel.

Typical DX times for “I/O Schedule 2015” App

That means we no longer start a new VM for each dx instance — giving the JIT more opportunity to optimize code, and removing the overhead of starting multiple parallel VM instances.

If your project has a lot of modules, you’ll see significant speed gains here.

If you’re using Proguard (which you should be), it creates a single JAR that effectively disables the advantages related to pre-dexing, so we’ve developed a new Shrinker for you to use in debug builds.

Typical “build and shrink” times for “I/O Schedule 2015” App

The Shrinker doesn’t replace Proguard — it replaces only the shrinking functionality — so you’ll still need to run Proguard on release builds to optimize and obfuscate your code.

When debugging, we now ask you to select a deploy target before your app is built. We’ll check what resources are required for that particular device and package and deploy only those resources.

Selective resource deployment for your target debug device

Initially this is applied to image resource resolutions, but future Android Studio releases will apply this feature to ABIs and legacy multidex.

The New Emulator

If it’s been a while since you last used our Emulator, it might be time to take another look.

It’s much faster — the speed of the adb push/pull protocol has been dramatically improved, and now in many circumstances running the new emulator on typical dev hardware is faster than using a physical Android device.

APK deploy and install times for a 50Mb app

To achieve this we’ve added SMP support to take advantage of host multi-core architecture, and significantly increased speed by optimizing GPU, IO, and CPU performance.

We also completely rebuilt the UI.

It’s easier to apply hardware and context changes, like changing screen orientation, GPS location, cellular network conditions, and battery state — or simulating incoming phone calls or texts.

We’ve also added support for deploying APKs on the emulator through drag & drop, and let you re-scale the emulator frame by dragging a corner.

Experimental GPU Profiler

If you’re building games or other graphic-intensive apps, take a look at our experimental new GPU profiler and debugger.

It lets you record an apps GPU stream, and lets you replay and inspect it frame-by-frame — so you can examine the GPU state for each draw command, within each frame, to understand what caused each rendering outcome.

Built on IntelliJ 15 and With Improved Testing Support

Being built on IntelliJ 15, you can take advantage of its improved stability and a number of new features — including improvements to integrations with version control systems, and cool new features like Find in Path Preview, and Distraction Free Mode.

There’s also a unified user interface for testing that includes a Test Runner Tool window, inline statistics, and test result history. On top of that, we’ve improved our testing support — Android and Unit test source sets can now both be active while you develop, enabling refactoring across all test source sets.

Deep Linking and Cloud Test Lab

It’s also easier to create Deep Links within your app. We’ve added static code inspections to check your links are correctly configured, and real-time testing to confirm Google can index and render your app pages correctly.

Cloud Test Lab integration is now enabled by default, making it easier you to run through a collection of tests against a portfolio of physical devices hosted in Google’s datacenters.

A new interface helps you configure the tests you want to run on the Cloud Test Lab, and shows you the results of your tests.

Stay on the Cutting Edge

Want to play with the latest and greatest features in Android Studio, but worried about destabilizing your dev environment? Check out this article: How Often Should You Update Android Studio?

Catch more Android Studio tips, tricks, and release details from Android Tool Time on Youtube.

It’s Android Tool Time Time

--

--

Reto Meier
Google Developers

Developer Advocate @ Google, software engineer, and author of “Professional Android” series from Wrox. All opinions are my own.