AndroidX is the open-source project that the Android team uses to develop, test, package, version and release libraries within Jetpack.
AndroidX is a major improvement to the original Android Support Library, which is no longer maintained. Like the Support Library, AndroidX ships separately from the Android OS and provides backwards-compatibility across Android releases.
In addition AndroidX includes the following features:
- All packages in AndroidX live in a consistent namespace starting with the string
androidx
. The Support Library packages have been mapped into correspondingandroidx.*
packages. For a full mapping of all the old classes and build artifacts to the new ones, see the Package Refactoring page. - Unlike the Support Library, AndroidX packages are separately maintained and updated. The
androidx
packages use strict Semantic Versioning starting with version 1.0.0. You can update AndroidX libraries in your project independently. - Version 28.0.0 is the last release of the Support Library. There will be no more
android.support
library releases. All new feature development will be in theandroidx
namespace.
Using AndroidX
If you want to use AndroidX in a new project, you need to set the compile SDK to Android 9.0 (API level 28) or higher and set both of the following Android Gradle plugin flags to true
in your gradle.properties
file.
android.useAndroidX
: When set totrue
, the Android plugin uses the appropriate AndroidX library instead of a Support Library. The flag isfalse
by default if it is not specified.android.enableJetifier
: When set totrue
, the Android plugin automatically migrates existing third-party libraries to use AndroidX by rewriting their binaries. The flag isfalse
by default if it is not specified.
Migrate an existing project using Android Studio
With Android Studio 3.2 and higher, you can quickly migrate an existing project to use AndroidX by selecting Refactor > Migrate to AndroidX from the menu bar.
If you have any Maven dependencies that have not been migrated to the AndroidX namespace, the Android Studio build system also migrates those dependencies for you when you set the following two flags to true
in yourgradle.properties
file:
android.useAndroidX=true
android.enableJetifier=true