Android Architecture Components is a set of Architecture Components officially provided by Google for designing and building more robust, testable, and maintainable applications.

In this section we will explain how to introduce Architecture Components into the project, which is currently available from the Google Maven repository.

Add the following content to your project’s build.gradle file

allprojects {
    repositories {
        jcenter()
        maven { url 'https://maven.google.com'}}}Copy the code

Open the build.gradle file of the Moudule and add dependencies as needed.

##LifeCycle

  • Implementation “android. Arch. Lifecycle: the runtime: 1.0.3” is not necessary, if you use lifecycle: extensions or lifecycle: common – java8
  • AnnotationProcessor “android. Arch. Lifecycle: the compiler: 1.0.0” / / is not a must, if you use the common – java8 DefaultLifecycleObserver
  • Implementation “android. Arch. Lifecycle: common – java8:1.0.0” / / support java8 needs to be added

# # LiveData and ViewModel

  • Implementation “android. Arch. Lifecycle: extensions: 1.0.0”
  • TestImplementation “android.arch.core:core-testing:1.0.0″// Test using LiveData in the worker thread
  • Implementation “android. Arch. Lifecycle: reactivestreams: 1.0.0” / / used with ReactiveStream API

##Room

  • Implementation “android. Arch. Persistence. Room: the runtime: 1.0.0”
  • AnnotationProcessor “android. Arch. Persistence. Room: the compiler: 1.0.0”
  • TestImplementation “android. Arch. Persistence. Room: testing: 1.0.0” / / testing room
  • Implementation “android. Arch. Persistence. Room: rxjava2:1.0.0” RXJava / / support

##Paging

  • Implementation “android. The arch. The paging: runtime: 1.0.0 – alpha3”

All kinds of latest technical articles will be updated in my public number, welcome to pay attention to.