Google recently released the Android Studio 2.0 Preview with some compelling new features for developers. One of the biggest and most welcome changes is the improved emulator that comes included with the preview. The new instant run ability and faster build times also offer nice quality of life improvements for developers by allowing them to make code changes and see them reflected in their running applications much faster. I decided to test out the new IDE with some of our existing samples to get some experience with the new features and see if I encountered any roadblocks. The most up to date builds of Android Studio can be obtained on the Android Tools Project Site. You'll also want to have the Intel Hardware Accelerated Execution Manager (HAXM) installed which you can get from their developer site which enables the new high performance emulators.
The new Emulators are significantly faster than the old ones. Assuming you've installed the Android Studio 2.0 Preview and HAXM you're ready to go. I tested out some of our existing samples, and everything worked without issue, just much faster than before. I put together a short side by side comparison of the Getting Started section of the FlexGrid 101 sample run on both emulators to highlight the speed difference. https://vimeo.com/150705566 Opening and closing samples is radically faster, and scrolling is also drastically improved in the emulator. It's now much easier to get a sense of how your application will actually perform without deploying it to a device.
Instant Run is a nice feature that allows you to push your code changes to a running app immediately without completely restarting the app which can be a nice time saver. The above video also includes a small section showing a single example of changing the background color of a chart on the fly. New projects created in Android Studio 2.0 should be configured for this automatically while old projects simply need some changes made to the project preferences to enable the functionality. To update an older project, go to your project Preferences, expand the Build, Execution, Deployment group, open Instant Run and Enable the options in that pane for your project (there should be also be an option to update your project). After you've updated you may need to do some further updates to your build.gradle files to get them to run correctly. For this existing Xuni 101 projects, I found that I needed to update the classpath to 'com.android.tools.build:gradle:2.0.0-alpha2' (though this is likely to once again change in the future). Once that change was made I could set my Preferences to appear as follows:
Android Studio 2.0 addresses many of the performance deficiencies that were previously inherent to the out of the box Android development experience. The update also brings a nice update to GPU profiling which is a little out of the scope of this article, but still worth mentioning for those developing graphically intense applications. Overall, Google has done a lot in Android Studio 2.0 to improve the quality of life of the average Android Developer. Most developers will certainly welcome these changes when the final version of the IDE is released, and I'm happy to report that Xuni appears to be working much as expected in the new IDE only with much better emulated performance. If you have further interest in using Xuni with Android Studio check out the training videos on our Vimeo channel. This Getting Started Video for Xuni Android featuring the new Android Studio 2.0 Preview may be of particular interest: https://vimeo.com/149910880