A Brand New Android Studio – 3.0!
There are few events in life that give developers such bliss and excitement as when their favorite tools receive a healthy refresher. Earlier this week the kind and hard-working folks over at Google released the official version of their long-awaited upgrade to Android Studio. It wasn’t an unusually long wait (Google seems to release new major versions roughly every 6 months), but the anticipation of diving into its new features has kept me watching Android Studio’s Stable Channel for months.
In the events leading up to Google I/O in May, the Android Studio team had teased the community with some incredible new features for Android Studio 2.4. Many developers, myself included, had our collective fingers crossed for a surprise release at the event and were shocked when Google announced official support for Kotlin in Android development. Additionally, they boldly nixed the 2.4 version of Android Studio from existence, bumped to a clean version 3.0, and continued pushing out numerous betas and release candidates. Now, many moons later, we’re blessed with a well-tested and feature-packed development environment ready for production use.
Without any further ado, let’s talk about some of those new features.
A few years ago, Kotlin burst onto the Android scene and was met with both praise and skepticism. JVM languages like Kotlin aren’t uncommon and most aren’t well suited for Android development (with the notable exception of Groovy, which Gradle uses). However, continued Kotlin development attracted more and more followers. Plugins were made for Android Studio and soon Kotlin became a common concept for cutting edge developers. Google must have been keeping its eye on Kotlin as well, and for the first time in Android’s history, Google announced full first-party support for another programming language to sit alongside Java (ignoring the NDK, since Google most certainly does!). Kotlin’s concise syntax shares similarity with numerous other languages, notable Swift, Apple’s preferred iOS and Mac OS development language. It addresses numerous Java shortcomings such as null safety, a lack of class extension functions, and easy threading support via coroutines. The full list of Kotlin features is long and you can read about them here!
On the topic of languages, Java got some love this time around as well. For a multitude of reasons, Android’s Java doesn’t always have the same functionality as the base language. One of the most common criticisms of Java is its verbosity, especially with anonymous classes. You know, the ones you make to implement callback interfaces like
View.OnClickListener. Java introduced support for lambda expressions, which are essentially abbreviated functions to reduce repetitive boilerplate code, in Java 8. However, Android struggled to provide support for lambda expressions; you had to use the experimental (okay, buggy) Jack toolchain or the 3rd party Retrolambda library. Finally, Android developers can use natively-supported lambda expressions. This is a huge plus for libraries like RxJava which rely on numerous single-method interfaces, making them prime candidates for lambda expressions and drastically reducing code length.
The last new piece I’ll talk about is an upgrade to Android Studio itself. For as long as I can remember, I’ve been using the Android Device Monitor to profile the performance of my apps. It was a little ugly and a little hard to use, but it got the job done. Google used its magic and transformed it into the Android Profiler. Earning a proud place next to the Build and Stop buttons, the Android Profiler button opens CPU, memory, and network monitors right within the Android Studio window and sits nicely next to Logcat and your other bottom toolbar menus. You can monitor performance, view payload information, find laggy parts of your apps, admire the very pretty interface this amazing suite sits within, and more. I’m eagerly looking forward to testing my apps and improving my code using these upgraded profiling tools.
I could go on but instead you should go download the new version of Android Studio yourself and play around!