Android Studio 2.0 Speeds Emulation, Adds On-the-Fly Testing

275

When Google released Android Studio 1.0 integrated development environment (IDE) back in 2013, it was welcomed as a substantial improvement over Eclipse. Yet, Apple’s Xcode tools for iOS has been widely considered to be superior. With the recent release of Android Studio 2.0, however, Google may have flipped the equation.

Android Studio 2.0 introduces a much faster emulator, as well as an “Instant Run” feature for quickly testing minor code changes. Version 2.0 also adds a Cloud Test Lab service, plus an improved GPU Developer debugger and an app indexing feature.

The IDE continues to fill the gap between high-end Android SDK and Native Development Kit (NDK) tools and a variety of cross-platform Android-compatible, mobile app frameworks like Onsen, Kendo UI, and Sencha Touch. Unlike these mostly JavaScript- and HTML5-focused programs, as well as alternatives like Qt and Microsoft’s Xamarin, Android Studio can only be used to develop Android apps. Yet, it also supports Android Auto, Android Wear, and Android TV in addition to mobile apps.

Android Studio 2.0 arrived a month after Google released the first developer preview for the upcoming Android N, which is expected to arrive fully baked in the third quarter, possibly to be dubbed Android 7.0. Android N provides the first native Android support for split screens, and offers improvements to notifications and power-saving.

Like Android Studio 2.0, Android N is built around Java 8. Yet, Java’s domination of Android may be in jeopardy. The Next Web reports that Google is considering transitioning Android from Java to Apple’s open source Swift language (see farther below).

Android Studio 2.0 speeds testing and emulation

The previously previewed Instant Run feature is ready to roll in Android Studio 2.0. This time-saving extension to the run and debug commands uses a VM swap feature that sends only code that has changed for testing on an emulated device without requiring a recompile or a reinstallation of the APK.

Android Studio 2.0 introduces a much faster emulator.

Instant Run “may take longer to complete,” according to the release notes, but after that, minor changes can be tested much more quickly, accelerating edit, build, and run cycles. Based on the changes indicated, Android Studio automatically determines whether to use hot, warm, or cold swaps. With a hot swap, you can update a live, running app, whereas a warm swap requires a restart of the activity and a cold swap needs an app restart.

The feature is optimized for the newly enhanced Android Emulator, which is claimed to run about three times faster than the original. This is largely due to the fact that it’s now optimized for multi-core system-on-chips. With ADB enhancements in the build cycle, “you can now push apps and data 10x faster to the emulator than to a physical device,” says Google. 

Other emulator improvements include new features for testing battery, network, GPS, and phone calls, as well as integrated Google Play Services for checking additional API functions. The overhauled interface features drag and drop APKs, plus support for multi-touch actions and easier window resizing and rescaling, says Google.

After using Android Emulator, you can turn to a new physical emulation service called Cloud Test Lab. The currently free service lets developers test an app across a wide range of real-world devices and device configurations hosted on Google servers.

Android Studio 2.0 adds an App Indexing API that helps to improve app search and discovery. The feature helps developers devise the best URL structure for their app code, as well as add attributes to AndroidManifest.xml to streamline indexing.

Finally, if you’re developing OpenGL ES based games or other graphics-rich apps, you can check out the GPU debugger, which is debuting in a preview release. The debugger enables the debugging of graphics rendering problems frame by frame, and supplies “rich information about the GL state,” says Google.

As before, Android Studio provides an IntelliJ IDEA-based Java code editor, now updated to IntelliJ 15. Android Studio continues to offer a Gradle-based build system and ProGuard tools for manipulating code. Once again, there’s a GUI layout editor, template based wizards and preview layouts for multiple screen configurations.

Is Google switching from Java to Swift?

The same week Android Studio arrived, the future of Java development for Android came into question. The Next Web cited unnamed sources claiming Google is considering elevating Apple’s Swift to be a “first class” language for Android alongside Java. Swift, which was adopted by Apple for Xcode as a more user-friendly replacement for the gnarly Objective C, was open sourced in December. 

According to the story, Swift won’t replace Java, at least initially. Yet, Swift will be ready to step in in case Google’s six-year long, Java-related legal battle with Oracle continues to tip toward Larry Ellison’s lawyers. Oracle recently demanded a staggering $8.8 billion in damages for the case, which resumes in early May.

In late December, Google quietly replaced its own implementation of standard Java libraries in favor of Oracle’s open source OpenJDK. Google pitched the move as a step toward openness that will make life easier for Java developers. Yet, it may also be a way to minimize potential legal damages from the Java lawsuit, possibly as part of a longer transition to Swift.

The object-oriented Swift has other benefits aside from not being under litigation. It’s open source and optimized for mobile, and generally considered to be easy to use and strong on safety-oriented features. Sharing the same programming environment with iOS should streamline cross-platform development. 

Swift has been adopted by companies ranging from IBM to Lyft, and Facebook and Uber are also said to be expanding its use. Yet, it would be harder for Google to switch Android to Swift, says The Next Web. Among other hurdles, Google would need to create a runtime for Swift and find a way to bridge it to Android’s low-level C++ APIs. 

Meanwhile, Java has plenty going for it, and the language got a boost last October when Microsoft’s Xamarin acquired RoboVM and its Java-based technology. Another possibility mentioned by The Next Web’s sources is that Google will move to the Java-friendly, yet Swift-like Kotlin, which is already supported by Android Studio.

https://www.youtube.com/watch?v=xxx3Fn7EowU?list=PLWz5rJ2EKKc_w6fodMGrA1_tsI3pqPbqa