JavaScript Required

We're sorry, but we doesn't work properly without JavaScript enabled.

What is Android JetPack?

Android JetPack is the support library, includes android-ktx and the Android Architecture Components re-branded as a single modular entity. It is a larger-scoped effort to improve Android app developers experience, but AndroidX forms the technical foundation. It is the same libraries you will find under Support Library and Architecture Components.

android-jetpack

The Android Jetpack components include the existing Support Library and Architecture Components and put them into four categories:

  1. Architecture

  2. UI

  3. Behavior

  4. Foundation

Architecture

This area of Jetpack currently includes eight different libraries and tools that help us to architect our app and manage the data used by the app. There are mostly existing libraries but, there are three new libraries namely:

  1. Navigation

  2. Paging

  3. WorkManager

Navigation: This is quite similar to Storyboards in Apple’s Interface Builder for iOS app development. By navigation, we can visually design how the screens are connected to one another.

Paging: This gradually loads information on demand from your data source. This library will also help by providing ways to handle the paging of data in a RecyclerView.

WorkManager: This solves the problem of background jobs or alarms in android and gives only one library for creating deferrable, asynchronous tasks and defining when they should be run.

UI

This area of JetPack currently includes animations, fragments, palettes, layouts, Emojis, Android Auto, Wear, and TV. The EmojiCompat library is the newest of the libraries and gives you up-to-date emojis and the fonts needed to use them.

EmojiCompat: This libraryhandles emoji characters and uses downloadable font support. It also allows the app to stay up to date with the latest emojis without depending on the Android OS. So whenever you update this library dependency, you will have the latest emojis. There is also a concrete Span class called EmojiSpan that is used to create emojis in the text.

Behavior

This area of JetPack currently includes media, notifications, permissions, downloading, sharing and the new one is Slices library.

Slices: This library creates UI templates to share the data through the system in rich, flexible layouts. Currently, it is only used by the Google Search App. Developers can make the app data available to these apps using Slices so that a user can find information from your app by using Google Search or the Assistant.

Foundation

This area of JetPack includes that old AppCompat library and the new Kotlin KTX extension library for easier development in Kotlin.

Kotlin KTX: This KTX modules are linked to other libraries in Jetpack. For example, Navigation library can be used something like this:

  • Android.arch.navigation:navigation-common-ktx

  • Android.arch.navigation:navigation-fragment-ktx

  • Android.arch.navigation:navigation-runtime-ktx

  • Android.arch.navigation:navigation-ui-ktx

SharedPreference is the best example here to explain.

Earlier for saving preference, we were doing something like this:

sharedPreferences.edit() .putBoolean("key", value) .apply()

But now by KTX-based code:

sharedPreferences.edit() .putBoolean("key", value)

You can see that apply() has been removed and we no need to add it now.