What Is AndroidX?

W
Photo by Eirik Solheim on Unsplash

Whether you’re an experienced Android developer or are new to the platform, if you have written Android code recently, it’s highly likely that you have seen AndroidX all over the place. If you’re like me, most likely you don’t look into the details behind what this term means or what the difference is between it and other imports you make to your app, like the Support Library. But if you’re here, most likely you’re wondering what’s behind AndroidX. I hope to clarify some of your doubts about it.

First things first. AndroidX stands for Android E X tension Libraries. This simple denotation makes it clearer for an experienced developer what’s behind the term. But if that’s not the case for you, don’t worry, I will go into detail soon.

Before diving deeper, I would like to explore the first definition found in the Android documentation when searching for AndroidX:

“Artifacts within the androidx namespace comprise the Android Jetpack libraries. Like the Support Library, libraries in the androidx namespace ship separately from the Android platform and provide backward compatibility across Android releases.” — AndroidX Overview

I think that’s a bit hard to read and comprises a large amount of terminology that could be hard to wrap up. At the end of this piece, you’ll be able to go back to this definition and know what they were trying to say.

Background on Android Versioning

Android has a particular methodology for versioning the operating system. Currently (January 2020) there have been ten major versions of Android. The most recent version of Android is Android 10 (easy isn’t it?), released to the public on September 3, 2019. This is the version that should have been known as Android Q. All previous versions of Android were named alphabetically as a dessert: Android 1.5 Cupcake, Android 4.0 Ice Cream Sandwich, Android 9.0 Pie. But Android 10.0 was the exception as the corresponding dessert had to be named with Q, can you think of a name with Q? Well, Android branders apparently couldn’t or didn’t find any good enough, so this last version is just Android 10.

What Is the Support Library?

In the second sentence of their definition, we can find the following text: “Like the support library, libraries in the AndroidX namespace… .” From this, we notice that they are assuming we all know what the support library is. Maybe you do, but just in case you don’t, let’s review it.

Each Android version has different capabilities and new additions. Thinking back to the origins of Android in 2008, smartphones have changed a lot, which means they added and removed a large number of features. In the beginning, it was as simple as migrating from a physical to a digital keyboard, up to advanced features like the AI assistant aka “Ok Google.” Before the release of Android 9.0, we used the so-called Support Library to make our apps compatible across all the versions. These libraries managed features available or unavailable in different versions and helped developers create usable apps on all devices.

Why Is the Support Library Needed?

If you’re an Android user, you probably know that when you buy your device, it will get a couple of updates, but eventually, you won’t get new versions of Android. This is in part driven by hardware limitations, among other things. This is a larger topic for another piece.

The important thing here is that different Android versions may have different names for libraries, methods, and functionality that are integrated within the operating system and won’t be delivered within your app APK. So to make sure the compiler understands your code and executes the same or similar functionality in all devices, support libraries take control and carry out this job for us. Support libraries are shipped with your app and are not tied to the Android version.

If you want to dive deeper into the details of Support Library, have a look at Android documentation on this topic: https://developer.android.com/topic/libraries/support-library

Photo by Jon Tyson on Unsplash

Up to now, we have clarified all of the second sentence of the Android documentation: “Like the Support Library, libraries in theandroidx namespace ship separately from the Android platform and provide backward compatibility across Android releases.” Yay us! Hopefully, these sounds more understandable now.

We can go on and explore the first sentence: “Artifacts within the androidx namespace comprises the Android Jetpack libraries… .”

What Is Android Jetpack?

The first thing mentioned there is Android Jetpack. This is a big topic by itself, but then again, let’s look at the Android documentation and their definition:

“Jetpack encompasses a collection of Android libraries that incorporate best practices and provide backwards compatibility in your Android apps.” — Getting Started with Android Jetpack

Photo by Mathew Schwartz on Unsplash

At least the definition here is easier to read, but did you think the same thing I did? The definition sounds exactly as if we were describing the Support Libraries. If we were in a multiple-choice exam and the options were a. Jetpack and b. Support Library, honestly, I wouldn’t know which to choose. (I hope there would be a c. All of the above).

So here comes a new question: What is the difference between the Support Library and the new Jetpack? Basically, Jetpack is better organized and will be more consistent across devices. In developer terms, Jetpack is a refactor of all the support libraries. Why do I say all? Because if you look at the support libraries, they had different versions (v4, v7, v12, etc.) which made them really confusing and was becoming a big mess. With this change, you don’t have to worry about the version because Jetpack knows what code to use. In essence, they are the same, but from the outside, they are all condensed and become less work for the developer.

From the above and looking back to the definition, we can see that any library that starts with the word AndroidX is automatically part of Jetpack.

Hopefully, this piece answered the question that brought you here. In my opinion, it’s a bit confusing having two separate terms, Android Jetpack and AndroidX. Even if it’s not essential to understand all the logic behind the things we use day to day, knowledge of our subject will help us become better developers.

Until next time!

About the author

Evana Puig

Add Comment

By Evana Puig

Evana Puig

Get in touch

Mobile Developer expert in Android and iOS, with 10 years of experience. Visit me at evanapuig.com. Author, and topic master at raywenderlich.com