Android Jetpack & AndroidX

website

The Android Jetpack’s official website

About Jetpack (from the official website)

Jetpack is a suite of libraries that help developers follow best practices, reduce boilerplate code and write code that runs consistently across Android versions and devices, allowing developers to focus on writing important code.

What is AndroidX?

The Android Support package is designed to enable the use of new technologies on older versions of Android. Support for older versions is provided in the form of compatible packages. This has always been the case with V4/V7/V13 in the past, but compatibility packages are very confusing due to each iteration of the release. So Android has now rebuilt a whole new compatibility system called AndroidX.

AndroidX has been out for a long time and is the direction of the future, based on this, it is recommended that all projects should move to AndroidX entirely. Completely abandon the old ways.

Jetpack and AndroidX are simply the same thing. Easy to understand without too much confusion. Jetpack’s package names mostly start with AndroidX.

How do I use Jetpack

It’s written very clearly on the Jetpack website using the get started website and just take a look at it. The current version of Android Studio uses the basic default

What’s in Jetpack?

There are more listed on the official website. And the structure of the website is constantly changing, so how can we learn about Jetpack?

In the past, the Jetpack components were grouped into four broad categories

  • Foundation (Foundation Component)
  • Architecture (Architecture component)
  • Behavior (Behavior Component)
  • UI (Interface component)

However, you can no longer see this classification on the official website, which is a little different from the display on the official website page in the past.

UI components
  1. Animation & transitions
  2. Activity
  3. Fragment
  4. Layout
  5. Emoji

Familiar or not, Emoji is a new component library. The other components are the components we use every day in our daily projects. Simply speaking, these things are just changed into a package name, which is completely the same with the past use. Therefore, we only need to learn a small part of the new use

Foundation: Base group post-compatibility, testing, and Kotlin language support
  1. Android KTX
  2. AppCompat
  3. Multidex
  4. Security
  5. Test
  6. TV
  7. Wear OS

There are some basic components listed here, such as those you would use if you were developing a TV App or Wear OS

The most important thing is to support Kotlin and just use it as needed

Behavior (Behavior Component)
  1. CameraX
  2. DownloadManager
  3. Media & playback
  4. Notifications
  5. Permissions
  6. Preferences
  7. Sharing
  8. Slices

The Behavior component is actually an API that we’ve been using in the past. But Android provides us with unified system support.

Architecture(Architecture Components)
  1. Lifecycles
  2. LiveData
  3. ViewModel
  4. Data Binding
  5. Navigation
  6. Paging
  7. Room
  8. WorkManager

Architecture components are the ones that must be highlighted here

Personally understand that when you switch to AndroidX, other components, except architecture components, other components are basically the same, just change the package name, basically do not need to learn again. However, some new components have been added as well. Architectural components, however, are different

First of all, it used to be that everyone could develop apps without architectural components, and that’s how it used to be, which made for a very confusing architectural scene. Every company uses different technologies, and many still use MVC, many switch to MVP, and many switch to MVVM, and everyone has different understandings and implementations. There are a lot of MVP /MVVM frameworks out there, and some of them have bugs in the bottom.

So the architectural components of AndroidX are kind of official and provide a common architectural approach. You can build apps without having to, but if you want to build a bug-free, well-compatible app, it takes a lot of effort, and JetPack architecture components can help you solve that problem, right? Is there any reason not to use it

So how do you learn JetPack

Based on the above analysis, it is recommended to look at the other components and just get the architectural components done.

Modern Android development must be based on the JetPack architecture, except that all you want to write is a Demo.

There are some architectural components listed above, so learn them one by one. And each architectural component is actually not that difficult

When each is understood, it can be used in combination to create an efficient, high stability. Simple logic, APP

There will be some articles on architectural components later, hope you enjoy them