Jetpack is a box of libraries that help developers to follow best practises in coding, and reduce boilerplate code. These libraries are available in Google Maven repository
Many jetpack libraries provide Android KTX extensions as shown below.
dependencies {
def lifecycle_version = “2.2.0”
implementation “androidx.lifecycle:lifecycle-livedata-ktx:$lifecycle_version”
implementation “androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version”
…
}
With Jetpack you can get following advantages like:-
- WorkManager can be used for background scheduling needs
- Room is used for database related stuff.
- Navigation is used to manage application navigation flow.
- CameraX for your camera app needs last but not the least
- You can also see the overview of the jetpack libraries.
Jetpack libraries are been published in androidX namespace and we have to migrate our project, if we want to make use of Jetpack libraries.
There are many Jetpack libraries which are often used like
- databinding for binding UI components in your layout
lifecycle for lifecycle aware components that can adjust behavior based on
the current lifecycle state of an activity. - paging for loading data in pages and representing in form of recyclerview.
The best reason to use Jetpack libraries is to reduce complexities in terms of using libraries and making development easier for the developer as well as works as support libraries for android.
Below is a basic architecture components of android Jetpack.
Above image explains the basics of Jetpack components and there are many more components being added as Android gets updated everytime