Android Studio 2.0 Introduces Hot Code Swapping
Android Studio 2.0 has hit the canary channel, and the focus of the improvements in this release is to make the development as streamlined as possible, including hot code swapping, faster builds, faster emulator, GPU Profiler and Debugger, and running multiple types of tests in the same time.
Perhaps the most significant enhancement coming in Android Studio 2.0 is Instant Run. A code change is immediately (1-2 sec) deployed on a connected physical device or emulator and executed without going through a full or incremental build and APK deployment. The feature was demonstrated during Android Dev Summit 2015 (video). It will be made available on “virtually every emulator on use today” and “every current physical device” that runs Android ICS or later.
Currently, Instant Run supports instance or static method implementation changes and adding/removing a class. It can also handle changes to a string resource but it requires to restart the related activity. A number of changes – editing annotations, fields, method signatures, etc. - are not supported yet, but Google is working on supporting them in the following months.
Android Studio 2.0 comes with a number of other improvements:
- The initial build time is 2-2.5 times faster
- Incremental builds are in the “single digits seconds”
- The emulators are “massively faster than they were before”. A graphic showed the ADB push speed of the emulator being over 15x faster than on Android Studio Emulator 1.0 and over 5 times faster than on a physical device (Nexus 6) due to better I/O. Also, the emulator now uses SMP to take advantage of multicores existing on the development machine.
- The emulator‘s UI has been rewritten to support drag and drop and resizing
- The IDE supports other forms of emulation: GPS (including multiple points simulating a route), calls and text messages, battery states
- It is built on the recently released IntelliJ 15
- Both Android and Unit Tests can be run in the same time
- It adds support for deep linking including verification if Google Search can index the application correctly
Last but not least, Android Studio 2.0 has a GPU Profiler and Debugger that can replay a scene frame by frame. This tool is appealing to developers working with OpenGL ES in maps, videos and games.
For truly "Instant Run"