Building Google Android Apps in 2017

Android, Google

Google’s Android operating system is now nine years old. Its next iteration, codenamed “O,” will certainly appear before the end of the year. (In keeping with Google’s longtime naming tradition, the “O” will likely become a dessert of some sort—possibly “Oreo.”)

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, available with Android “O.” In simplest terms, Treble will attempt 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 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.

Coding

Java (currently on version 8) has long been the standard way of developing for Android. Android does not support all Java 8 features, although a handful—such as Lambda expressions and type annotations—are available when targeting Android 7.0 (API level 24).

But Java isn’t the only way to develop for Android, thanks to several cross-platform solutions including JavaScript (PhoneGap, Sencha,Titanium), Lua (Corona), and C# (Xamarin); in addition, Android Studio now has support for C/C++ with the NDK (Native Development Kit).

That brings us to Kotlin, which earlier this year received official support as an Android development language.

Kotlin

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 JDK 6 (the current Java Development Kit version is 8), 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.

Android Studio

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.

Android Things

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.

Firebase

Acquired by Google in 2014, Firebase is a mobile platform with web services that can be used from version 26 (Android O) onward. Google Analytics for Firebase is the core functionality (and is also available for iOS, Unity and C++); other services include Cloud Messaging, which can push messages to iOS apps as well as Android, Unity, C++ and Web (via JavaScript). There are also storage, hosting, authentication, and cloud functions.

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.

Conclusion

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.

Post a Comment

Your email address will not be published.