Open In App

Difference Between AndroidX and Android Support Libraries

Improve
Improve
Like Article
Like
Save
Share
Report

Support library packages in Android are a set of code libraries whose prime purpose is to provide backward-compatibility to the code and Android API framework. In the real world, there is a strong possibility that an application that is developed on the latest Android version is used on an older version of Android OS. Thus, including the support libraries in the project files is the best practice to follow while developing android applications. Further, these libraries are also needed for the features which are provided only through library API.

Android Support Libraries(com.android.support)

These library packages are provided by Google to provide backward compatibility to android applications. The name of these packages ends with the minimum version of Android API supported by the libraries. For example, package name support-v4 and the support-v7 indicate that the minimum supported Android API version is 4 and 7 respectively. However, the continuous advancement in library function and modules leads to the minimum supported Android API level version changed to level 14(Android 4.0) along with the release of support library version 26.0.0 in July 2017

AndroidX Package Libraries(androidx.*)

Introduced along with the release of Android Jetpack in 2018, AndroidX is a brand new way of organizing the support libraries. The older support libraries were somewhat confusing for the developers as one cannot say that which all classes are included in a particular library just by looking at its name. To address this issue, Google launched AndroidX(stands for Android E X tension) libraries with the release of Android 9.0 (API level 28). Any library name which starts from androidx. is automatically becomes part of the Jetpack. It includes the existing android support library along with the latest Jetpack components. Moreover, developers need not bother about the version of libraries because Jetpack knows what code to use. 

Difference Table

Android Support Libraries

AndroidX Package Libraries

Syntax of writing dependency: com.android.support:recyclerview-v7 Syntax of writing dependency: androidx.recyclerview:recyclerview
While using support libraries in the project, it is mandatory to keep the same version for all the support libraries. Developers are free to use a different version of dependency for different android components.
Dependencies that are required to add in order to use an android component in the application include various other things that are of no use.  Developers are allowed to add only those dependencies which they are going to use in the application.
The package of support library is bundled with the Android operating system. For eg: android.content.Intent Unbundled libraries are moved to androidx.* namespace and are packed with application’s APK. For eg: androidx.fragment.app.Fragment
The package name contains the minimum supported API level. The package has no dependency on the API level.
All dependencies are required to update before using because all the support libraries need to have the exact same version specification. AndroidX libraries can be updated individually. Thus, developers can update only those libraries which are needed in the project.
The support of com.android.support libraries have been stopped by Google. It is the recommended library package by Google to use in the project.

Note:

With the release of Android API level 28 i.e, Android 9.0, Google has stopped the support for com.android.support libraries and advised the developers to use AndroidX libraries which are a part of Jetpack for all new projects. To know what is the new mapping of support libraries in AndroidX, click here.

Google also provide the feature to migrate an existing project in order to use the AndroidX libraries. Visit this link to read the official Google documentation.


Last Updated : 16 Jan, 2023
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads