BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage News Google Overhauls the Android Support Library into AndroidX

Google Overhauls the Android Support Library into AndroidX

This item in japanese

Bookmarks

The new Android extension library (AndroidX) is a replacement for the seven-year old Support library, aiming to streamline things and provide a solid foundation for the further evolution of the library.

The Android Support library provides an effective way to partially mitigate Android ecosystem fragmentation by allowing developers to support newer OS features on older versions of Android or fallback to equivalent functionality. According to Google:

The adoption of the Support Library has been phenomenal; most Android apps use the Support Library today.

Yet, its organic growth has led to a number of choices that many developers find confusing. One such example is the existence of components and packages named "v7", which was the original Android SDK level required by the library, albeit version 14 (Android 4.0) is currently the minimal required SDK.

The first improvement that AndroidX aims to bring is helping developers differentiate which packages belong to the OS and which ship with the application's Application Package Kit (APK). Usually, shipping (unbundled) libraries with APKs is a great way to ensure a single API is available for those libraries across different versions of Android. When using AndroidX, all unbundled libraries belong to the namespace androidx.*, including all Support libraries and Architecture Components. This should help make clear which dependencies should be included in the APK.

Additionally, AndroidX redesigns the package structure with the aim to encourage smaller libraries and both Support libraries and Architecture Components package names have been simplified. Here you can get a list of all refactoring changes.

As a final note, AndroidX adopts strict semantic versioning to make it clear when binary compatibility is guaranteed or likely broken. For example, a dependency on a 1.5.0 revision of AndroidX will still work with 1.7.0, but it will likely not work with 2.0.0.

The changes brought by AndroidX definitely have an impact on existing code bases, requiring both code refactoring and dependency translation. To help developers port their codebases, Android Studio Canary 14 includes a refactoring feature to make the process as straightforward as possible.

AndroidX is still considered alpha quality and subject to changes breaking compatibility. Furthermore, there are known issues, so Google does not recommend trying it out on production projects.

Rate this Article

Adoption
Style

BT