// ViewModel and LiveData implementation "androidx.lifecycle:lifecycle-extensions:$lifecycle_version" // alternatively - just ViewModel implementation "androidx.lifecycle:lifecycle-viewmodel:$lifecycle_version"// use -ktx for Kotlin // alternatively - just LiveData implementation "androidx.lifecycle:lifecycle-livedata:$lifecycle_version" // alternatively - Lifecycles only (no ViewModel or LiveData). Some UI // AndroidX libraries use this lightweight import for Lifecycle implementation "androidx.lifecycle:lifecycle-runtime:$lifecycle_version"
annotationProcessor "androidx.lifecycle:lifecycle-compiler:$lifecycle_version"// use kapt for Kotlin // alternately - if using Java8, use the following instead of lifecycle-compiler implementation "androidx.lifecycle:lifecycle-common-java8:$lifecycle_version"
// optional - ReactiveStreams support for LiveData implementation "androidx.lifecycle:lifecycle-reactivestreams:$lifecycle_version"// use -ktx for Kotlin
// optional - Test helpers for LiveData testImplementation "androidx.arch.core:core-testing:$lifecycle_version" }
// ViewModel and LiveData implementation "android.arch.lifecycle:extensions:$lifecycle_version" // alternatively - just ViewModel implementation "android.arch.lifecycle:viewmodel:$lifecycle_version"// use -ktx for Kotlin // alternatively - just LiveData implementation "android.arch.lifecycle:livedata:$lifecycle_version" // alternatively - Lifecycles only (no ViewModel or LiveData). // Support library depends on this lightweight import implementation "android.arch.lifecycle:runtime:$lifecycle_version"
annotationProcessor "android.arch.lifecycle:compiler:$lifecycle_version"// use kapt for Kotlin // alternately - if using Java8, use the following instead of compiler implementation "android.arch.lifecycle:common-java8:$lifecycle_version"
// optional - ReactiveStreams support for LiveData implementation "android.arch.lifecycle:reactivestreams:$lifecycle_version"
// optional - Test helpers for LiveData testImplementation "android.arch.core:core-testing:$lifecycle_version" }
implementation "androidx.room:room-runtime:$room_version" annotationProcessor "androidx.room:room-compiler:$room_version"// use kapt for Kotlin
// optional - RxJava support for Room implementation "androidx.room:room-rxjava2:$room_version"
// optional - Guava support for Room, including Optional and ListenableFuture implementation "androidx.room:room-guava:$room_version"
// Test helpers testImplementation "androidx.room:room-testing:$room_version" }
Pre-AndroidX
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
dependencies { def room_version = "1.1.1"
implementation "android.arch.persistence.room:runtime:$room_version" annotationProcessor "android.arch.persistence.room:compiler:$room_version"// use kapt for Kotlin
// optional - RxJava support for Room implementation "android.arch.persistence.room:rxjava2:$room_version"
// optional - Guava support for Room, including Optional and ListenableFuture implementation "android.arch.persistence.room:guava:$room_version"
// Test helpers testImplementation "android.arch.persistence.room:testing:$room_version" }
implementation "android.arch.navigation:navigation-fragment:$nav_version"// use -ktx for Kotlin implementation "android.arch.navigation:navigation-ui:$nav_version"// use -ktx for Kotlin
// optional - Test helpers // this library depends on the Kotlin standard library androidTestImplementation "android.arch.navigation:navigation-testing:$nav_version" }