ArchitectureComponentsTest——架构组件的一些demo
- RoomTest Room数据库Demo
- DataBindingTest 数据绑定Demo
- LifeCycleTest LifeCycleTestDemo
- MvvmTest Mvvm架构Demo
- NavigationTest Navigation导航Demo
-
根目录的**
build.gradle
**加入google repository
allprojects { repositories { google() //add google repository jcenter() } }
-
根目录的**
build.gradle
**或自定义的gradle
文件定义全局版本号:ext { roomVersion = '2.2.0' archLifecycleVersion = '2.2.0-beta01' coreTestingVersion = '2.1.0' materialVersion = '1.0.0' nav_version = '2.1.0' }
-
app
的**build.gradle
**中导入依赖// Room components implementation "androidx.room:room-runtime:$rootProject.roomVersion" annotationProcessor "androidx.room:room-compiler:$rootProject.roomVersion" androidTestImplementation "androidx.room:room-testing:$rootProject.roomVersion" // Lifecycle components implementation "androidx.lifecycle:lifecycle-extensions:$rootProject.archLifecycleVersion" annotationProcessor "androidx.lifecycle:lifecycle-compiler:$rootProject.archLifecycleVersion" // navigation implementation "androidx.navigation:navigation-fragment:$rootProject.nav_version" implementation "androidx.navigation:navigation-ui:$rootProject.nav_version" // UI implementation "com.google.android.material:material:$rootProject.materialVersion" // Testing androidTestImplementation "androidx.arch.core:core-testing:$rootProject.coreTestingVersion"