Modernizing Your Android App — an Exercise in Bewilderment

Robert Mirabelle
4 min readMay 26, 2019

A cursory perusal of today’s Android landscape is likely to turn up all manner of exciting new features that promise to improve your life as an Android developer.

Kotlin

First and foremost, there’s Kotlin. The “new sexy” and language de jeur for working with the JVM. Kotlin offers a superior development experience to Java, but is, in fact, a whole new language with a coding style that typically favors brevity over clarity.

Personally, I much preferred Groovy, but Google has made Kotlin the “official” language of Android, so I guess that’s that.

Jetpack

Then there is Android Jetpack, which grants Android apps fabulous new superpowers like:

  • One and two-way Data Binding
  • New Lifecycle-Aware components that can hook into the lifecycle of other components
  • A ViewModel component containing Live Data that automatically persists across device configuration changes
  • A fluent SQL tool called Room
  • and much more!

Material Design

You can modernize your Android app even further with Google’s Material Design Components for Android, a whole host of shiny, nay sexy new components that promise (then fail) to deliver a standardized look and feel to your app.

Pro-tip: When you search for Material Design, you’ll be whisked away to what is effectively Material Design University, where you’ll learn how to design every pixel of every everything just how Google wants you to. Material Design is not the droid you’re looking for. Material Design Components for Android is.

Let’s Modernize!

I can hear you now:

“Man, seems like there’s finally a bunch of really good stuff happening for Android. I’ll take Kotlin, Jetpack and Material Design to go, please!”

No. The correct answer is No.

If you read my love letter to the Android SDK and ecosystem at large, you’ll be fully not surprised to learn that in response to your request:

“Give me Kotlin.”

Android Studio effectively responds with:

“Which Kotlin features would you like?”

What? How would I know? I don’t even know what “features” there are. I thought Kotlin was a language. Just give me the language, please!

But wait. It gets FAR worse. In response to your request:

“Give me Jetpack.”

Android Studio effectively responds with:

“Which of the nearly endless myriad of individual Jetpack components would you like?”

What? I don’t even know what the individual components are yet. How the hell am I supposed to tell you which ones I want? Gimmie the whole damn thing and I’ll decide later. Or better yet, don’t make me decide at all, and use tree shaking to automatically exclude the components I don’t use from my build!

No. The correct answer is No.

You see, poor Android developer fool, Jetpack isn’t a thing. It looks like a thing. It smells like a thing. It’s documented like a thing. It’s promoted like a thing. It’s taught like a thing. It’s described like a thing. But it is not a thing.

Jetpack is a whole new world of things. And nearly each and every Jetpack feature must be enabled individually before you can use it! But to enable a feature, you’re gonna first have to do a thousand hours of research just to decide whether you might want the feature or not.

build.gradle to the rescue

Let me preface this section with a simple observation: Saying build.gradle out loud makes me want to puke.

Cherry-picking Jetpack features for Android is its own special Hell on Earth.

Thankfully(?), most of the toil is centered around your Module’s build.gradle file (puke).

After wasting huge chunks of time researching the specific modifications to build.gradle (puke) to enable Kotlin, Jetpack and Material Design Components, here’s an example of how yours should probably look.

By tomorrow, half the version numbers below will be out of date, but thankfully, Android Studio should auto-prompt you to update to the latest versions of everything.

I’ve included comments to give you some clue as to what features we’re enabling:

Android Modernized! Let’s Go!

This is the point where the obligatory apology to all Android developers must occur. Now that you’ve basically ‘installed’ the features that will modernize your Android app development experience, it’s time to run out, learn a whole new programming language, and the minute inner workings of a thousand new individual components. Best of luck!

Heads up

The Jetpack components are dope. There’s no 2-ways about it. They function really well and solve a host of long-standing issues that have plagued Android development for years.

But the learning curve is just STUPID. Documentation for all these new components is like a bad comedy — basically nothing more than a cursory introduction with unintelligible code samples, and then you’re on your own. For example, did you know that the Material Design Components for Android doesn’t include a Spinner? Be prepared to do what you’ve always done as an Android developer; namely, to suffer.

--

--