1. What is Jetpack
A collection of components that Google launched in 2018. Its purpose is to unify android development standards, improve the efficiency of Android development, improve the quality of applications.
It is divided into four parts
- Architecture: Architecture components
- UI: UI components
- Behavior: Behavior component
- Foundation: Basic components
Jetpack official address:
developer.android.google.cn/jetpack/
2. Architectural components
- Data Binding: Bind interface components in the layout to Data sources in the application using declarative characters.
- Lifecycles: Build lifecycle-aware components that adjust their behavior based on the current lifecycle state of an Activity or Fragment.
- LiveData (Lifecycles-based data transmission) : A life-cycle aware component that sends data while the component is active.
- Navigation: Builds and organizes in-app interfaces, handles deep links and navigates between screens.
- Paging: Loads data in a page and renders it in RecyclerView.
- Room (Database) : Creates, stores, and manages persistent data supported by SQLite databases.
- ViewModel (data store) : A life-cycle aware data store component, usually used in combination with LiveData.
- WorkManager (Background Task Management) : Schedules and executes background tasks that can be deferred and based on constraints.
3. UI components
- Animation&Transaction: animation
- Auto,TV&Wear: vehicle equipment,TV and other large screen equipment, wearable equipment
- Emoji: Displays emojis on current and older devices.
- Fragment: Subdivide your application into separate screens hosted in a single Activity.
- Layout: indicates the interface Layout
- Palette: To extract a representative Palette from an image.
Behavior components
- DownLoader Manager: downloads management
- Media&Playback: sharing media content and controls with other applications.
- Permissions: Application permission
- Notifcations: application notifications
- Sharing: Shortcuts can be used as direct Sharing targets.
- Slice: Displays templated interface elements outside the application.
5. Basic components
- AppCompat: A compatibility base Api that allows access to new apis (many using Material Design) over older versions of the platform’s apis.
- Android KTX: A set of Kotlin extensions included in Android Jetpack and other Android libraries. The KTX extension provides concise idiomatic Kotlin code for Jetpack, the Android platform, and other apis
- Multidex: Deploy an application containing multiple dex files on a device running an earlier version of Android 5. (subcontracting)
- Test: Tests on Android.
Part of the description above is from Jetpack’s website:
Developer. The android. Google. Cn/jetpack/and…
6. Prerequisites
- AndroidStudio: Using AndroidStudio 3.2 and later, now on top of Version 4.0.
- Gradle. The properties set
android.useAndroidX=true
android.enableJetifier=true
Copy the code
- The lowest supported Android version is minSdkVersion: 21
7. Learn the main ideas
Here are a few ideas for learning Jetpack:
-
** This is one of the core points of the Jetpack component. Lifecycle, ViewMode, and LiveData all depend on the lifecycle.
-
Learn Jetpack like a new control: ** Think about how to learn RecyclerView and other new controls introduced by Google. Jetpack also contains a lot of new controls. These controls are not very complicated to learn, they will be familiar with a few times.
-
** Be familiar with the observer mode: ** Many components rely on the observer mode, such as observing the life cycle of an Activity\Fragment.
-
** Code more: ** Practice makes perfect!
-
Go to the official website for sample code.