Google’s Android operating system is now more than a decade old. Its next iteration, codenamed “Q,” will certainly appear before the end of the year. (In keeping with Google’s longtime naming tradition, the “Q” will likely become a dessert of some sort—good luck thinking of a good one that starts with that letter.)
If you’re a developer, there are lots of reasons to consider Android as a platform for your software-building endeavors. Because Google opted to give away the OS to any hardware manufacturer, there are over a billion active Android devices worldwide—a substantial install base for your next app.
However, the freedom that Google gave hardware manufacturers also came with a singular drawback: fragmentation. Or to put it another way, thousands of wildly different form factors run all sorts of Android versions and variations, making it problematic to build an app that will successfully run on everything out there.
Google’s solution for fragmentation is Project Treble, which was first available with Android “O.” In simplest terms, Treble attempted to alter Android’s low-level system architecture. “The core concept is to separate the vendor implementation — the device-specific, lower-level software written in large part by the silicon manufacturers — from the Android OS Framework,” read Google’s blog posting on the matter. “With a stable vendor interface providing access to the hardware-specific parts of Android, device makers can choose to deliver a new Android release to consumers by just updating the Android OS framework.”
In theory, by removing the need for silicon manufacturers to exert additional effort, it should have become easier for manufacturers and vendors to update devices to the latest and greatest version of Android, easing at least some of the functionality and security concerns that stem from fragmentation. But the problem persists; only 10 percent of Android phones run “Pie,” the most recent OS version, and 16 percent still run “Marshmallow,” which is ancient Android 6.
Java has long been the standard way of developing for Android. Android does not support all Java features, although a handful—such as Lambda expressions and type annotations—are available when targeting Android 7.0 (API level 24) and above.
That brings us to Kotlin, which Google named its primary language for Android development earlier this year.
Kotlin is an open-source programming language from JetBrains, the creator of the Intellij Idea IDE that underpins Android Studio, Google’s official development toolkit for Android. It is 100 percent interoperable with Java; you can call Java code from Kotlin or Kotlin code from Java, which lessens the risk when converting your app from Java to Kotlin.
If you’re considering whether to build an app with Android, should you use Kotlin? Here are a few reasons why it’s potentially a good idea.
First, your code is shorter—approximately 40 percent fewer lines, according to the Kotlin website FAQ.
In addition, Kotlin is compatible with the current Java Development Kit (JDK), and the tooling is fully supported in Android Studio. Kotlin runtime adds less than 100Kb to the size of the .apk file.
If you’re still unsure about Kotlin for Android, read Basecamp’s experiences with an app wholly built in the language. In a recent blog post, Google’s Chet Haase claimed over 50 percent of Android developers now use Kotlin, and underscored its favorability in studies. Dice data suggests Kotlin jobs are spiking, suggesting companies are also turning away from Java when it comes to Android-related app-building.
Android Studio improves with each successive version; it now features lots of JetBrains slickness. As a developer, I have just one complaint (and it’s not Studio’s fault): debugging doesn’t work on Windows if Hyper-V is enabled.
Originally called Project Brillo, Android Things is about programming for the Internet of Things (IoT) using low-cost hardware and Android software. Google has partnered with SoC companies to build Android-certified development boards with System on Modules (SoM). There are half a dozen systems available; the best-known is probably Raspberry PI 3.
You have to pay for Firebase services once your application’s resource use goes above a certain limit, but the free tier gives you more than enough to try it out.
It’s an interesting time to be an Android Developer, thanks to tools such as Firebase and Kotlin. If you haven’t worked with Android, now’s a great time to give it a try.