//androidx版本 lifecycle
implementation group: 'androidx.lifecycle', name: 'lifecycle-runtime', version: '2.0.0'
implementation group: 'androidx.lifecycle', name: 'lifecycle-common', version: '2.0.0'
implementation group: 'androidx.lifecycle', name: 'lifecycle-livedata', version: '2.0.0'
implementation group: 'androidx.lifecycle', name: 'lifecycle-viewmodel', version: '2.0.0'
//包含livedata + viewmodel
implementation group: 'androidx.lifecycle', name: 'lifecycle-extensions', version: '2.0.0'
//包含kotlin
implementation group: 'androidx.lifecycle', name: 'lifecycle-viewmodel-ktx', version: '2.0.0'
implementation group: 'androidx.lifecycle', name: 'lifecycle-livedata-ktx', version: '2.0.0'
//
implementation group: 'androidx.lifecycle', name: 'lifecycle-common-java8', version: '2.0.0'
//arch版本 lifecycle
implementation group: 'android.arch.lifecycle', name: 'extensions', version: '1.1.1'
implementation group: 'android.arch.lifecycle', name: 'runtime', version: '1.1.1'
implementation group: 'android.arch.lifecycle', name: 'livedata', version: '1.1.1'
implementation group: 'android.arch.lifecycle', name: 'viewmodel', version: '1.1.1'
implementation group: 'android.arch.lifecycle', name: 'livedata-core', version: '1.1.1'
implementation group: 'android.arch.lifecycle', name: 'common', version: '1.1.1'
implementation group: 'android.arch.lifecycle', name: 'common-java8', version: '1.1.1'
//输出依赖关系到txt文件
gradlew -q :app:dependencies >log.txt
lifecycle-extensions: 包含 livedata 、viewmodel 、lifecycle
+--- androidx.lifecycle:lifecycle-extensions:2.2.0-alpha01
| +--- androidx.lifecycle:lifecycle-runtime:2.2.0-alpha01 (*)
| +--- androidx.arch.core:core-common:2.1.0-beta01 (*)
| +--- androidx.arch.core:core-runtime:2.1.0-beta01 (*)
| +--- androidx.fragment:fragment:1.0.0 -> 1.1.0-beta01 (*)
| +--- androidx.lifecycle:lifecycle-common:2.2.0-alpha01 (*)
| +--- androidx.lifecycle:lifecycle-livedata:2.2.0-alpha01 (*)
| +--- androidx.lifecycle:lifecycle-process:2.2.0-alpha01
| | \--- androidx.lifecycle:lifecycle-runtime:2.2.0-alpha01 (*)
| +--- androidx.lifecycle:lifecycle-service:2.2.0-alpha01
| | \--- androidx.lifecycle:lifecycle-runtime:2.2.0-alpha01 (*)
| \--- androidx.lifecycle:lifecycle-viewmodel:2.2.0-alpha01 (*)
lifecycle-livedata-ktx: 包含kotlin 和 livedata
+--- androidx.lifecycle:lifecycle-livedata-ktx:2.2.0-alpha01
| +--- org.jetbrains.kotlin:kotlin-stdlib:1.3.20 -> 1.3.41 (*)
| +--- org.jetbrains.kotlinx:kotlinx-coroutines-core:1.1.1 -> 1.3.0-M2 (*)
| +--- androidx.lifecycle:lifecycle-livedata:2.2.0-alpha01 (*)
| \--- androidx.lifecycle:lifecycle-livedata-core-ktx:2.2.0-alpha01
| +--- org.jetbrains.kotlin:kotlin-stdlib:1.3.20 -> 1.3.41 (*)
| \--- androidx.lifecycle:lifecycle-livedata-core:2.2.0-alpha01 (*)
lifecycle-viewmodel-ktx: 包含kotlin 和 viewmodel
androidx.lifecycle:lifecycle-viewmodel-ktx:2.2.0-alpha01
+--- org.jetbrains.kotlin:kotlin-stdlib:1.3.20 -> 1.3.41 (*)
+--- org.jetbrains.kotlinx:kotlinx-coroutines-android:1.1.1 -> 1.3.0-M2
| +--- org.jetbrains.kotlin:kotlin-stdlib:1.3.40 -> 1.3.41 (*)
| \--- org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.0-M2
| +--- org.jetbrains.kotlin:kotlin-stdlib:1.3.40 -> 1.3.41 (*)
| \--- org.jetbrains.kotlin:kotlin-stdlib-common:1.3.40 -> 1.3.41
\--- androidx.lifecycle:lifecycle-viewmodel:2.2.0-alpha01 (*)
lifecycle-runtime: 只包含 lifecycle
+--- androidx.lifecycle:lifecycle-runtime:2.0.0
| +--- androidx.lifecycle:lifecycle-common:2.0.0
| | \--- androidx.annotation:annotation:1.0.0
| +--- androidx.arch.core:core-common:2.0.0
| | \--- androidx.annotation:annotation:1.0.0
| \--- androidx.annotation:annotation:1.0.0
implementation 'androidx.appcompat:appcompat:1.0.2'
查看依赖可看到已包含了lifecycle的 viewmodel 、livedata
+--- androidx.appcompat:appcompat:1.0.2
| +--- androidx.annotation:annotation:1.0.0 -> 1.0.2
| +--- androidx.core:core:1.0.1 -> 1.0.2
| | +--- androidx.annotation:annotation:1.0.2
| | +--- androidx.collection:collection:1.0.0
| | | \--- androidx.annotation:annotation:1.0.0 -> 1.0.2
| | +--- androidx.lifecycle:lifecycle-runtime:2.0.0
| | | +--- androidx.lifecycle:lifecycle-common:2.0.0
| | | | \--- androidx.annotation:annotation:1.0.0 -> 1.0.2
| | | +--- androidx.arch.core:core-common:2.0.0
| | | | \--- androidx.annotation:annotation:1.0.0 -> 1.0.2
| | | \--- androidx.annotation:annotation:1.0.0 -> 1.0.2
| | \--- androidx.versionedparcelable:versionedparcelable:1.0.0
| | +--- androidx.annotation:annotation:1.0.0 -> 1.0.2
| | \--- androidx.collection:collection:1.0.0 (*)
| +--- androidx.collection:collection:1.0.0 (*)
| +--- androidx.cursoradapter:cursoradapter:1.0.0
| | \--- androidx.annotation:annotation:1.0.0 -> 1.0.2
| +--- androidx.legacy:legacy-support-core-utils:1.0.0
| | +--- androidx.annotation:annotation:1.0.0 -> 1.0.2
| | +--- androidx.core:core:1.0.0 -> 1.0.2 (*)
| | +--- androidx.documentfile:documentfile:1.0.0
| | | \--- androidx.annotation:annotation:1.0.0 -> 1.0.2
| | +--- androidx.loader:loader:1.0.0
| | | +--- androidx.annotation:annotation:1.0.0 -> 1.0.2
| | | +--- androidx.core:core:1.0.0 -> 1.0.2 (*)
| | | +--- androidx.lifecycle:lifecycle-livedata:2.0.0
| | | | +--- androidx.arch.core:core-runtime:2.0.0
| | | | | +--- androidx.annotation:annotation:1.0.0 -> 1.0.2
| | | | | \--- androidx.arch.core:core-common:2.0.0 (*)
| | | | +--- androidx.lifecycle:lifecycle-livedata-core:2.0.0
| | | | | +--- androidx.lifecycle:lifecycle-common:2.0.0 (*)
| | | | | +--- androidx.arch.core:core-common:2.0.0 (*)
| | | | | \--- androidx.arch.core:core-runtime:2.0.0 (*)
| | | | \--- androidx.arch.core:core-common:2.0.0 (*)
| | | \--- androidx.lifecycle:lifecycle-viewmodel:2.0.0
| | | \--- androidx.annotation:annotation:1.0.0 -> 1.0.2
| | +--- androidx.localbroadcastmanager:localbroadcastmanager:1.0.0
| | | \--- androidx.annotation:annotation:1.0.0 -> 1.0.2
| | \--- androidx.print:print:1.0.0
| | \--- androidx.annotation:annotation:1.0.0 -> 1.0.2
| +--- androidx.fragment:fragment:1.0.0
| | +--- androidx.core:core:1.0.0 -> 1.0.2 (*)
| | +--- androidx.legacy:legacy-support-core-ui:1.0.0
| | | +--- androidx.annotation:annotation:1.0.0 -> 1.0.2
| | | +--- androidx.core:core:1.0.0 -> 1.0.2 (*)
| | | +--- androidx.legacy:legacy-support-core-utils:1.0.0 (*)
| | | +--- androidx.customview:customview:1.0.0
| | | | +--- androidx.annotation:annotation:1.0.0 -> 1.0.2
| | | | \--- androidx.core:core:1.0.0 -> 1.0.2 (*)
| | | +--- androidx.viewpager:viewpager:1.0.0
| | | | +--- androidx.annotation:annotation:1.0.0 -> 1.0.2
| | | | +--- androidx.core:core:1.0.0 -> 1.0.2 (*)
| | | | \--- androidx.customview:customview:1.0.0 (*)
| | | +--- androidx.coordinatorlayout:coordinatorlayout:1.0.0
| | | | +--- androidx.annotation:annotation:1.0.0 -> 1.0.2
| | | | +--- androidx.core:core:1.0.0 -> 1.0.2 (*)
| | | | \--- androidx.customview:customview:1.0.0 (*)
| | | +--- androidx.drawerlayout:drawerlayout:1.0.0
| | | | +--- androidx.annotation:annotation:1.0.0 -> 1.0.2
| | | | +--- androidx.core:core:1.0.0 -> 1.0.2 (*)
| | | | \--- androidx.customview:customview:1.0.0 (*)
| | | +--- androidx.slidingpanelayout:slidingpanelayout:1.0.0
| | | | +--- androidx.annotation:annotation:1.0.0 -> 1.0.2
| | | | +--- androidx.core:core:1.0.0 -> 1.0.2 (*)
| | | | \--- androidx.customview:customview:1.0.0 (*)
| | | +--- androidx.interpolator:interpolator:1.0.0
| | | | \--- androidx.annotation:annotation:1.0.0 -> 1.0.2
| | | +--- androidx.swiperefreshlayout:swiperefreshlayout:1.0.0
| | | | +--- androidx.annotation:annotation:1.0.0 -> 1.0.2
| | | | +--- androidx.core:core:1.0.0 -> 1.0.2 (*)
| | | | \--- androidx.interpolator:interpolator:1.0.0 (*)
| | | +--- androidx.asynclayoutinflater:asynclayoutinflater:1.0.0
| | | | +--- androidx.annotation:annotation:1.0.0 -> 1.0.2
| | | | \--- androidx.core:core:1.0.0 -> 1.0.2 (*)
| | | \--- androidx.cursoradapter:cursoradapter:1.0.0 (*)
| | +--- androidx.legacy:legacy-support-core-utils:1.0.0 (*)
| | +--- androidx.annotation:annotation:1.0.0 -> 1.0.2
| | +--- androidx.loader:loader:1.0.0 (*)
| | \--- androidx.lifecycle:lifecycle-viewmodel:2.0.0 (*)
| +--- androidx.vectordrawable:vectordrawable:1.0.1
| | +--- androidx.annotation:annotation:1.0.0 -> 1.0.2
| | \--- androidx.core:core:1.0.0 -> 1.0.2 (*)
| \--- androidx.vectordrawable:vectordrawable-animated:1.0.0
| +--- androidx.vectordrawable:vectordrawable:1.0.0 -> 1.0.1 (*)
| \--- androidx.legacy:legacy-support-core-ui:1.0.0 (*)
androidx.core:core:
+--- androidx.core:core:1.0.1 -> 1.0.2
| +--- androidx.annotation:annotation:1.0.2
| +--- androidx.collection:collection:1.0.0
| | \--- androidx.annotation:annotation:1.0.0 -> 1.0.2
| +--- androidx.lifecycle:lifecycle-runtime:2.0.0
| | +--- androidx.lifecycle:lifecycle-common:2.0.0
| | | \--- androidx.annotation:annotation:1.0.0 -> 1.0.2
| | +--- androidx.arch.core:core-common:2.0.0
| | | \--- androidx.annotation:annotation:1.0.0 -> 1.0.2
| | \--- androidx.annotation:annotation:1.0.0 -> 1.0.2
| \--- androidx.versionedparcelable:versionedparcelable:1.0.0
| +--- androidx.annotation:annotation:1.0.0 -> 1.0.2
| \--- androidx.collection:collection:1.0.0 (*)