Android Jetpack is a set of components, tools and guidance to make great Android apps. The Android Jetpack components bring together the existing Support Library and Architecture Components and arranges them into four categories:
Android Jetpack components are provided as “unbundled” libraries that are not part of the underlying Android platform. Thus This means that you can adopt each component at your own speed, at your own time. When new Android Jetpack functionality is available, you can add it to your app, deploy your app to the Play Store and give users the new features all in a single day (if you’re quick)! The unbundled Android Jetpack libraries have all been moved into the new androidx.*
namespace.
In addition, your app can run on various versions of the platform because Android Jetpack components are built to provide their functionality independent of any specific version, providing backwards compatibility.
Further, Android Jetpack is built around modern design practices like separation of concerns and testability as well as productivity features like Kotlin integration. This makes it far easier for you to build robust, high quality apps with less code. While the components of Android Jetpack are built to work together, e.g. lifecycle awareness and live data, you don’t have to use all of them — you can integrate the parts of Android Jetpack that solve your problems while keeping the parts of your app that are already working great.
Android Jetpack is a collection of Android software components which helps us in building great Android apps.
Earlier there were many challenges which are as follows:
And TAll these major problems have been solved by the Android Jetpack’s software components.
So, the solution for all the problems is Andriod Jetpack.
Another most important thing about the Jetpack is that it gets updated more frequently than the Android platform so that we always get the latest version.
Jetpack comprises the androidx.* package libraries, unbundled from the platform APIs. This means that it offers backward compatibility.
Android Jetpack components are a collection of libraries that are individually adoptable and built to work together while taking advantage of Kotlin language features that make us more productive.
These software components have been arranged in 4 categories which are as follows:
The foundation components provide the following:
All the foundation components are as follows:
The architecture components help us in building:
All the architecture components are as follows:
The behavior components help in the integration with standard Android services like
All the behavior components are as follows:
The UI components provide widgets and helpers to make your app not only easy, but delightful to use.
All the UI components are as follows:
At its I/O 2019 developer conference, Google announced 10 new libraries for Android Jetpack, its set of components, tools, and guidance designed to accelerate app development. The company also unveiled Jetpack Compose, a new unbundled Kotlin toolkit.
Think of Android Jetpack as the successor to Support Library, a set of components that makes it easier to leverage new Android features while maintaining backwards compatibility. When Google launched Jetpack last year at I/O 2018, Android product manager Stephanie Cuthbertson described it as “the next generation of Android APIs designed to accelerate app development.”
Last year, Google said Support Library was used by 99% of all the apps in the Play Store. Today, Cuthbertson revealed that 80% of the top 1,000 apps in the Play store are using Jetpack.
In March, Google announced the stable releases of Jetpack WorkManager (background processing) and Jetpack Navigation (in-app navigation). The 10 new libraries the company is announcing today are deemed ready for production, even though they’re not quite finished.
CameraX:
Create camera-driven experiences in your application without worrying about the underlying device behavior or backwards compatibility. This API is backwards compatible to Android 5.0 (API 21) or higher, ensuring that the same code works on most devices in the market. It leverages the capabilities of camera2, but uses a simpler, use case-based approach that is lifecycle-aware. This eliminates significant boilerplate code when compared with camera2. It further enables you to access the same functionality as the native camera app on supported devices. Plus, optional extensions enable features like Portrait, Night, HDR, and Beauty.
LiveData and Lifecycles with coroutines:
Lifecycle & LiveData KTX support common one-shot asynchronous operations so you can use Kotlin coroutines that are lifecycle-aware. Offering coroutine scopes tied to lifecycles, coroutine dispatchers that are lifecycle-aware, and support for simple asynchronous chains with the new LiveData builder let you use Kotlin coroutines safely.
Benchmark:
A quick way to benchmark your app code, whether it is written in Kotlin, Java, or native code. Ensure you do not introduce any latency into your code right within your development environment in Android Studio. Easily measure database queries, view inflation, or a RecyclerView scroll. The library takes care of what is needed to provide reliable and consistent results, like handling warm-up periods, removing outliers, and locking CPU clocks.
Security:
Maximize security of an application’s data at-rest by letting this library implement security best practices for you. It provides strong security that balances encryption with performance for consumer apps like banking and chat. It also provides a maximum level of security for apps that require a hardware-backed keystore with user presence and simplifies many operations, including key generation and validation.
ViewModel with SavedState:
It provides an easy way to save your UI data in the event of a configuration change but doesn’t save your app state in the event of process death. ViewModel with SavedState lets you eliminate boilerplate code. Gain the benefits of using both ViewModel and SavedState with simple APIs to save and retrieve data right from your ViewModel.
ViewPager2:
ViewPager is now based on RecyclerView and supports vertical scrolling and RTL (Right-to-Left) layouts. It also provides a much easier way to listen for page data changes with registerOnPageChangeCallback
.
Google says these APIs were shaped using feedback from Android developers. The company specifically noted its early access developer programs, user studies, and communities on Reddit, Stack Overflow, and Slack.
Google today also open-sourced an early preview of Jetpack Compose. The new unbundled toolkit is meant to simplify UI development by combining a reactive programming model with Kotlin.
Don’t try Jetpack Compose on any production projects — the toolkit is nowhere near ready. “It’s not even alpha,” Chet Haase, chief advocate for Android, told VentureBeat. But Google is going to develop Jetpack Compose in the open anyway, starting today, in hopes of getting developers to share their thoughts.
Android group product manager Karen Ng led the Jetpack Compose effort. She told VentureBeat her team wanted to solve major developer pain points, and UI is an area that Jetpack hasn’t tackled yet.
“Jetpack Compose is built with all the benefits of Kotlin,” Ng explained. “So it’s entirely interoperable with Java. It’s fully declarative, for defining UI components, including drawing and custom layouts, which is not super common.
So it means that you can just describe your UI as a set of functions. And then the framework itself handles all the UI optimizations under the hood, and also automatically updates the view hierarchy, rather than having the app developer maintain that themselves. It’s compatible with all existing views. So you can mix and match our current views with what we call composable views. And then it’s designed with Material and animations right from the start.”
Google justifies Jetpack Compose by saying that developers like reactive APIs and love Kotlin. The company is thus investing in the reactive approach to declarative programming and creating a way to build UIs with Kotlin.
A Jetpack Compose application is made up of composable functions that transform application data into a UI hierarchy. To create a composable function, just add the @Composable annotation to the function name. Jetpack Compose uses a custom Kotlin compiler plugin under the hood — when the underlying data changes, the composable functions can be re-invoked to generate an updated UI hierarchy.