preface

Now the recruitment season has entered, this article aims to share the interview methods and experience of famous Internet company interviewers, hoping that through reading this article can bring programmers different interview experience and feelings, relax the interview mentality, and actively prepare for the interview!

Components in JetPack

Above is a list of the components included in JetPack, each of which is relatively independent and can be used and built on its own. LiveData, ViewModel, Room, Navigation, WorkManager, etc., which are the most introduced and most commonly used, are all released in official version, while CameraX, swarm, etc., are still in Alpha version. It is not officially recommended for use in production environments.

All JetPack components are built on AndroidX. If you want to use JetPack in your project, you need to change the Support Lib dependency to AndroidX.

Android has been developed for 11 years, which can be said to be a relatively mature technology. At the beginning, there were few frameworks and no specifications. All the code had to be written by ourselves, such as network requests, database requests, data parsing and so on. Later, some frameworks emerged to help developers develop quickly, such as XUtils, Volley, OKHttp, EventBus, etc. With more and more frameworks, one application can have multiple technology selection, which directly leads to more and more non-standard application development, resulting in uneven application quality, which is obviously not what Google wants to see. Google has since released an official example of MVP and MVVM, which is mediocre and covers only architectural issues, but Android Jetpack, which was unveiled at Google I/O 2018, is expected to address these issues.

Introduction to Android Jetpack

Jetpack is not a framework or component; it is a collection of libraries, tools, and guidelines that make it easier for developers to write quality applications. These components help developers follow best practices, get rid of boilerplate code, and simplify complex tasks so they can focus on the code they need. Many of the components in Android Jetpack are not new, but have been around for a long time, such as the Android Architecture Component (AAC) introduced at Goole I/O 2017, It includes LifeCycle, LiveData, ViewModel, Room. At Goole I/O 2018, Android Support Library was replaced with AndroidX and Android Architecture Component was released with Android Jetpack, AndroidX is also part of Android Jetpack.

Jetpack has three key features:

1. Accelerated development components can be used individually or in collaboration, which increases efficiency when using kotlin language features.

2. Eliminate boilerplate code Android Jetpack manages tedious activities such as background tasks, navigation, and lifecycle management.

The Android Jetpack component is built around modern design practices and is backward compatible to reduce crashes and memory leaks.

Android Jetpack category

Below is Jetpack’s taxonomy.

Google is still working on Android Jetpack, and as of August 2019 there are many new components that are not shown in the image above, such as CameraX. Android Jetpack has four categories: Architecture, Foundationy, Behavior, and UI.

1. Architecture

Architecture refers to the architectural components that help developers design robust, testable, and maintainable applications. Architectural components are arguably the most important component for application development, and this series focuses on architectural components.

DataBinding: Declaratively binds observable data to interface elements, usually in conjunction with ViewModel.

Lifecycle: Manage the Lifecycle of activities and fragments to help developers generate lightweight code that is easier to maintain.

LiveData: Notifies the view when the underlying database changes. It is an observable data holder, and unlike a regular Observable, LiveData is lifecycle aware. Navigation: Handles in-app Navigation.

Paging: Enables developers to load and display small pieces of data at a time. Loading partial data on demand reduces network bandwidth and system resource usage.

Room: Friendly and smooth access to SQLite database. It provides an abstraction layer on top of SQLite, allowing for more powerful database access.

ViewModel: Managing data related to the interface in a lifecycle manner, often in conjunction with DataBinding, provides powerful support for developers implementing the MVVM architecture.

WorkManager: A job that manages the Android background and can run deferred asynchronous tasks even after the application exits or the device is restarted.

The official recommended Android application architecture is shown below.

These architectural components can be used together or separately, and it is recommended to follow the official recommendations as much as possible.

2. Foundationy

The base component provides horizontal functionality, such as backward compatibility, testing, security, Kotlin language support, and includes multiple components developed for multiple platforms.

Android KTX: Optimized Jetpack and Android platform apis for Kotlin. Help developers use Kotlin for Android development in a simpler, more enjoyable, and more idiomatic way. AppCompat: Helps with compatibility with older versions of Android. Auto: The component that develops the Android Auto application that provides a standardized interface and user interaction for all vehicles. Check: quickly check Kotlin or java-based code from AndroidStudio. Multi-dex processing: Supports applications with multiple Dex files. Security: Secure reading and writing of encrypted files and sharing preferences. Testing: An Android testing framework for unit and runtime interface testing. TV: Build apps that allow users to experience immersive content on the big screen. Wear OS: Components for developing Wear applications.

3. Behavior

Behavior components help developers integrate their apps with standard Android services such as notifications, permissions, and sharing.

CameraX: Helps developers simplify the development of camera applications. It provides a consistent and easy-to-use interface that works with most Androids. The device is backward compatible to Android 5.0 (API 21). DownloadManager: A system service that handles long-running HTTP downloads. Media and Playback: Backward-compatible APIS for media playback and routing, including Google Cast. Notifications: Provides backwards-compatible notifications API, supports Wear and Auto. Permissions: Compatibility API for checking and requesting application permissions. Settings: Create interactive Settings. It is recommended to use the AndroidX Preference Library to integrate user-configurable Settings into the app. Sharing operations: User-friendly sharing operations can be implemented more easily. Slicing: Slicing is a UI template that creates flexible interface elements that display application data outside the application.

4. UI (Interface components)

Animation and Transition: This framework contains built-in animations for common effects and allows developers to create custom animations and lifecycle callbacks. Emoji Compatibility: Users can get the latest Emoji even if they haven’t updated Android. Fragment: Basic unit of a componentized interface. Layout: Declare UI elements in XML or instantiate UI elements in code. Palette: Extract useful information from the palette.

5. Introduce JetPack-related components into your application

Add the Google () library to the project build.gradle, as shown below.

  allprojects {
        repositories {
            google()
            jcenter()
        }
    }

Copy the code

If you want to introduce Room, you can write this in the build.gradle module:

Implementation "android. Arch. Persistence. Room: the runtime: 1.1.1" annotationProcessor "Android. Arch. Persistence. Room: the compiler: 1.1.1" androidTestImplementation "android. Arch. Persistence. Room: testing: 1.1.1"Copy the code

conclusion

This article is intended to give you an idea of what Android Jetpack is, what it includes, and how to reference it. Starting with the next article, you will learn about the architectural components of Android Jetpack.

Finally for programmers, to learn knowledge content, technology there are too many, not to be eliminated by the environment only to constantly improve themselves, we have always been to adapt to the environment, rather than the environment to adapt to us!

The last

In a word, the Android development industry is changing too fast, so as a technician, we should maintain a lifelong learning attitude and make learning ability become the core competitiveness. The so-called “lifelong learning”, only by constantly learning and constantly improving ourselves, can we keep up with the pace of the industry and not be eliminated by The Times.

Here I share a themselves, included finishing technology system diagram above related scores of companies such as tencent, headlines, ali, Meituan 19 years of interview questions, put together a video technology points and PDF (actually spent a lot of energy more than expected), contains the knowledge context + details, as space is limited, in the form of pictures here to show you. Need a friend can private letter I [information] or point here for free

There are advanced architecture technology advanced brain map, Android development interview topic information, advanced architecture information to help you learn to improve the advanced, but also save you on the Internet to search for information time to learn, can also share with friends around to learn together. Android learning PDF+ architecture video + the latest interview documents + source notes