Home » Android » Difference between android.* vs androidx.* package implementation and usage in android

Difference between android.* vs androidx.* package implementation and usage in android

Posted by: admin June 15, 2020 Leave a comment

Questions:

Google launch an early preview of the new Android extension libraries (AndroidX) which is basically new replacement of existing android support library and architecture packages as per their documentation.

But what is the actual difference between theseandroid and androidx package. Proper use case of these two packages and how can we convert existing android packages to androidx package. Which packages/libraries support these conversion?

How to&Answers:

AndroidX is basically a big refactoring Google’s made on their package structure. They changed the location of many classes to make it clearer which classes are bundled with the system and which ones aren’t.

As stated on their docs:

We are rolling out a new package structure to make it clearer which
packages are bundled with the Android operating system, and which are
packaged with your app’s APK. Going forward, the android.* package
hierarchy will be reserved for Android packages that ship with the
operating system
; other packages will be issued in the new androidx.*
package hierarchy.

The old support libs up to version 28 will remain available as they are, but the new versions of the support lib will be released under the AndroidX package refactor, starting from version 1.0.0.

Also, as taken from their refactoring list:

Only the package and Maven artifact names are affected; class, method,
and field names are not changing.

In other words, they’re just organizing their libs. You can read more about that on their blog post.

Answer:

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. Like the Support Library, AndroidX ships separately from the Android OS and provides backwards-compatibility across Android releases. AndroidX fully replaces the Support Library by providing feature parity and new libraries. 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 corresponding androidx.* 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 androidxpackages use strict Semantic Versioning starting with version 1.0.0. You can update AndroidX libraries in your project independently.
All new Support Library development will occur in the AndroidX library. This includes maintenance of the original Support Library artifacts and introduction of new Jetpack components.

Source : AndroidX Overview