Android--›迁移到AndroidX指南(含包依赖关系)

AndroidX发布已经有段时间了, 相应的包也都出了1.0.0正式版本.

顺势而为, 才能得以生存.

是时候迁移到AndroidX了.

迁移操作本身是很简单的, 有菜单命令一键搞定.如下:
Android--›迁移到AndroidX指南(含包依赖关系)_第1张图片

你以为这样就完事了?

还真是…项目妥妥的跑起来了, 还不算完事吗?

如果仅仅是为了跑起项目, 那还真的就完事了.

但是项目中的依赖包还是写的com.android.support:xxx:xxx, 所以要彻底迁移到AndroidX, 请继续往下看.

文章目录

  • 铲掉所有`com.android.support`的依赖包
  • 依赖包
    • androidx.legacy:legacy-support-v4
    • androidx.legacy:legacy-support-core-ui
    • androidx.annotation:annotation
    • androidx.core:core
    • androidx.core:core-ktx
    • androidx.appcompat:appcompat
    • androidx.fragment:fragment
    • androidx.activity:activity
    • androidx.recyclerview:recyclerview
    • androidx.cardview:cardview
    • androidx.constraintlayout:constraintlayout
    • androidx.coordinatorlayout:coordinatorlayout
    • com.google.android.material:material
    • androidx.viewpager2:viewpager2
    • androidx.localbroadcastmanager:localbroadcastmanager
    • androidx.exifinterface:exifinterface
    • androidx.test.ext:junit
    • androidx.test.espresso:espresso-core
  • 联系作者

铲掉所有com.android.support的依赖包

替换到最新的androidx对应的依赖包.

ext.androidx = [
        //com.android.support:support-v4
        "v4"                    : "androidx.legacy:legacy-support-v4:1.0.0",

        //com.android.support:exifinterface
        "exifinterface"         : "androidx.exifinterface:exifinterface:1.0.0",
        "vectordrawable"        : "androidx.vectordrawable:vectordrawable:1.1.0",

        //com.android.support:appcompat-v7
        "appcompat"             : "androidx.appcompat:appcompat:1.1.0",
        //com.android.support:support-compat
        "core"                  : "androidx.core:core:1.1.0",
        "corektx"               : "androidx.core:core-ktx:1.1.0",

        //com.android.support:support-fragment
        "fragment"              : "androidx.fragment:fragment:1.1.0",

        //com.android.support:recyclerview-v7
        "recyclerview"          : "androidx.recyclerview:recyclerview:1.0.0",

        //com.android.support:support-annotations
        "annotation"            : "androidx.annotation:annotation:1.1.0",

        //com.android.support:localbroadcastmanager
        "localbroadcastmanager" : "androidx.localbroadcastmanager:localbroadcastmanager:1.0.0",

        //com.android.support:design
        "material"              : "com.google.android.material:material:1.0.0",

        //com.android.support:cardview-v7
        "cardview"              : "androidx.cardview:cardview:1.0.0",

        //com.android.support.constraint:constraint-layout
        "constraintlayout"      : "androidx.constraintlayout:constraintlayout:1.1.3",
        //com.android.support.constraint:constraint-layout-solver
        "constraintlayoutsolver": "androidx.constraintlayout:constraintlayout-solver:1.1.3",

        //com.android.support:coordinatorlayout
        "coordinatorlayout"     : "androidx.coordinatorlayout:coordinatorlayout:1.0.0",

        //androidx only
        "viewpager2"            : "androidx.viewpager2:viewpager2:1.0.0-beta05",
]

我这里列举了一些常用的包. 点击这里查看所有

注意 那个对应关系后的版本, 可能不是最新版本号. 最新版本号点击查看

所有包都替换完之后, 难免会出现重复的依赖包, 这个时候可以查看我的另一篇文章
AS–›Gradle 自动查找依赖版本冲突,强制指定依赖版本号,
可以强制指定版本号

有的时候, 你会发现, 一个包里面包含了另一个包, 这个时候就没必要再引入包了.

我这里列举了常用了依赖包依赖关系:

依赖包

androidx.legacy:legacy-support-v4

+--- androidx.legacy:legacy-support-v4:1.0.0
|    +--- androidx.core:core:1.0.0 -> 1.1.0 (*)
|    +--- androidx.media:media:1.0.0
|    |    +--- androidx.annotation:annotation:1.0.0 -> 1.1.0
|    |    +--- androidx.core:core:1.0.0 -> 1.1.0 (*)
|    |    \--- androidx.versionedparcelable:versionedparcelable:1.0.0 -> 1.1.0 (*)
|    +--- androidx.legacy:legacy-support-core-utils:1.0.0 (*)
|    +--- androidx.legacy:legacy-support-core-ui:1.0.0 (*)
|    \--- androidx.fragment:fragment:1.0.0 -> 1.1.0 (*)

androidx.legacy:legacy-support-core-ui

+--- androidx.legacy:legacy-support-core-ui:1.0.0
|    +--- androidx.annotation:annotation:1.0.0
|    +--- androidx.core:core:1.0.0
|    |    +--- androidx.annotation:annotation:1.0.0
|    |    +--- androidx.collection:collection:1.0.0
|    |    |    \--- androidx.annotation:annotation:1.0.0
|    |    +--- 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
|    |    \--- androidx.versionedparcelable:versionedparcelable:1.0.0
|    |         +--- androidx.annotation:annotation:1.0.0
|    |         \--- androidx.collection:collection:1.0.0 (*)
|    +--- androidx.legacy:legacy-support-core-utils:1.0.0
|    |    +--- androidx.annotation:annotation:1.0.0
|    |    +--- androidx.core:core:1.0.0 (*)
|    |    +--- androidx.documentfile:documentfile:1.0.0
|    |    |    \--- androidx.annotation:annotation:1.0.0
|    |    +--- androidx.loader:loader:1.0.0
|    |    |    +--- androidx.annotation:annotation:1.0.0
|    |    |    +--- androidx.core:core:1.0.0 (*)
|    |    |    +--- androidx.lifecycle:lifecycle-livedata:2.0.0
|    |    |    |    +--- androidx.arch.core:core-runtime:2.0.0
|    |    |    |    |    +--- androidx.annotation:annotation:1.0.0
|    |    |    |    |    \--- 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
|    |    +--- androidx.localbroadcastmanager:localbroadcastmanager:1.0.0
|    |    |    \--- androidx.annotation:annotation:1.0.0
|    |    \--- androidx.print:print:1.0.0
|    |         \--- androidx.annotation:annotation:1.0.0
|    +--- androidx.customview:customview:1.0.0
|    |    +--- androidx.annotation:annotation:1.0.0
|    |    \--- androidx.core:core:1.0.0 (*)
|    +--- androidx.viewpager:viewpager:1.0.0
|    |    +--- androidx.annotation:annotation:1.0.0
|    |    +--- androidx.core:core:1.0.0 (*)
|    |    \--- androidx.customview:customview:1.0.0 (*)
|    +--- androidx.coordinatorlayout:coordinatorlayout:1.0.0
|    |    +--- androidx.annotation:annotation:1.0.0
|    |    +--- androidx.core:core:1.0.0 (*)
|    |    \--- androidx.customview:customview:1.0.0 (*)
|    +--- androidx.drawerlayout:drawerlayout:1.0.0
|    |    +--- androidx.annotation:annotation:1.0.0
|    |    +--- androidx.core:core:1.0.0 (*)
|    |    \--- androidx.customview:customview:1.0.0 (*)
|    +--- androidx.slidingpanelayout:slidingpanelayout:1.0.0
|    |    +--- androidx.annotation:annotation:1.0.0
|    |    +--- androidx.core:core:1.0.0 (*)
|    |    \--- androidx.customview:customview:1.0.0 (*)
|    +--- androidx.interpolator:interpolator:1.0.0
|    |    \--- androidx.annotation:annotation:1.0.0
|    +--- androidx.swiperefreshlayout:swiperefreshlayout:1.0.0
|    |    +--- androidx.annotation:annotation:1.0.0
|    |    +--- androidx.core:core:1.0.0 (*)
|    |    \--- androidx.interpolator:interpolator:1.0.0 (*)
|    +--- androidx.asynclayoutinflater:asynclayoutinflater:1.0.0
|    |    +--- androidx.annotation:annotation:1.0.0
|    |    \--- androidx.core:core:1.0.0 (*)
|    \--- androidx.cursoradapter:cursoradapter:1.0.0
|         \--- androidx.annotation:annotation:1.0.0

androidx.annotation:annotation

+--- androidx.annotation:annotation:1.1.0

androidx.core:core

+--- androidx.core:core:1.1.0
|    +--- androidx.annotation:annotation:1.1.0
|    +--- androidx.lifecycle:lifecycle-runtime:2.0.0
|    |    +--- androidx.lifecycle:lifecycle-common:2.0.0
|    |    \--- androidx.arch.core:core-common:2.0.0
|    +--- androidx.versionedparcelable:versionedparcelable:1.1.0
|    |    +--- androidx.annotation:annotation:1.1.0
|    |    \--- androidx.collection:collection:1.0.0
|    |         \--- androidx.annotation:annotation:1.0.0 -> 1.1.0
|    \--- androidx.collection:collection:1.0.0 (*)

androidx.core:core-ktx

+--- androidx.core:core-ktx:1.1.0
|    +--- org.jetbrains.kotlin:kotlin-stdlib:1.3.31 -> 1.3.50 (*)
|    +--- androidx.annotation:annotation:1.1.0
|    \--- androidx.core:core:1.1.0
|         +--- androidx.annotation:annotation:1.1.0
|         +--- androidx.lifecycle:lifecycle-runtime:2.0.0 -> 2.1.0
|         |    +--- androidx.lifecycle:lifecycle-common:2.1.0 (*)
|         |    +--- androidx.arch.core:core-common:2.1.0
|         |    |    \--- androidx.annotation:annotation:1.1.0
|         |    \--- androidx.annotation:annotation:1.1.0
|         +--- androidx.versionedparcelable:versionedparcelable:1.1.0
|         |    +--- androidx.annotation:annotation:1.1.0
|         |    \--- androidx.collection:collection:1.0.0 -> 1.1.0
|         |         \--- androidx.annotation:annotation:1.1.0
|         \--- androidx.collection:collection:1.0.0 -> 1.1.0 (*)

androidx.appcompat:appcompat

+--- androidx.appcompat:appcompat:1.1.0
|    +--- androidx.annotation:annotation:1.1.0
|    +--- androidx.core:core:1.1.0
|    |    +--- androidx.annotation:annotation:1.1.0
|    |    +--- androidx.lifecycle:lifecycle-runtime:2.0.0 -> 2.1.0
|    |    |    +--- androidx.lifecycle:lifecycle-common:2.1.0
|    |    |    |    \--- androidx.annotation:annotation:1.1.0
|    |    |    +--- androidx.arch.core:core-common:2.1.0
|    |    |    |    \--- androidx.annotation:annotation:1.1.0
|    |    |    \--- androidx.annotation:annotation:1.1.0
|    |    +--- androidx.versionedparcelable:versionedparcelable:1.1.0
|    |    |    +--- androidx.annotation:annotation:1.1.0
|    |    |    \--- androidx.collection:collection:1.0.0 -> 1.1.0
|    |    |         \--- androidx.annotation:annotation:1.1.0
|    |    \--- androidx.collection:collection:1.0.0 -> 1.1.0 (*)
|    +--- androidx.cursoradapter:cursoradapter:1.0.0
|    |    \--- androidx.annotation:annotation:1.0.0 -> 1.1.0
|    +--- androidx.fragment:fragment:1.1.0
|    |    +--- androidx.annotation:annotation:1.1.0
|    |    +--- androidx.core:core:1.1.0 (*)
|    |    +--- androidx.collection:collection:1.1.0 (*)
|    |    +--- androidx.viewpager:viewpager:1.0.0
|    |    |    +--- androidx.annotation:annotation:1.0.0 -> 1.1.0
|    |    |    +--- androidx.core:core:1.0.0 -> 1.1.0 (*)
|    |    |    \--- androidx.customview:customview:1.0.0
|    |    |         +--- androidx.annotation:annotation:1.0.0 -> 1.1.0
|    |    |         \--- androidx.core:core:1.0.0 -> 1.1.0 (*)
|    |    +--- androidx.loader:loader:1.0.0
|    |    |    +--- androidx.annotation:annotation:1.0.0 -> 1.1.0
|    |    |    +--- androidx.core:core:1.0.0 -> 1.1.0 (*)
|    |    |    +--- androidx.lifecycle:lifecycle-livedata:2.0.0
|    |    |    |    +--- androidx.arch.core:core-runtime:2.0.0
|    |    |    |    |    +--- androidx.annotation:annotation:1.0.0 -> 1.1.0
|    |    |    |    |    \--- androidx.arch.core:core-common:2.0.0 -> 2.1.0 (*)
|    |    |    |    +--- androidx.lifecycle:lifecycle-livedata-core:2.0.0
|    |    |    |    |    +--- androidx.lifecycle:lifecycle-common:2.0.0 -> 2.1.0 (*)
|    |    |    |    |    +--- androidx.arch.core:core-common:2.0.0 -> 2.1.0 (*)
|    |    |    |    |    \--- androidx.arch.core:core-runtime:2.0.0 (*)
|    |    |    |    \--- androidx.arch.core:core-common:2.0.0 -> 2.1.0 (*)
|    |    |    \--- androidx.lifecycle:lifecycle-viewmodel:2.0.0 -> 2.1.0
|    |    |         \--- androidx.annotation:annotation:1.1.0
|    |    +--- androidx.activity:activity:1.0.0
|    |    |    +--- androidx.annotation:annotation:1.1.0
|    |    |    +--- androidx.core:core:1.1.0 (*)
|    |    |    +--- androidx.lifecycle:lifecycle-runtime:2.1.0 (*)
|    |    |    +--- androidx.lifecycle:lifecycle-viewmodel:2.1.0 (*)
|    |    |    \--- androidx.savedstate:savedstate:1.0.0
|    |    |         +--- androidx.annotation:annotation:1.1.0
|    |    |         +--- androidx.arch.core:core-common:2.0.1 -> 2.1.0 (*)
|    |    |         \--- androidx.lifecycle:lifecycle-common:2.0.0 -> 2.1.0 (*)
|    |    \--- androidx.lifecycle:lifecycle-viewmodel:2.0.0 -> 2.1.0 (*)
|    +--- androidx.appcompat:appcompat-resources:1.1.0
|    |    +--- androidx.annotation:annotation:1.1.0
|    |    +--- androidx.core:core:1.0.1 -> 1.1.0 (*)
|    |    +--- androidx.vectordrawable:vectordrawable:1.1.0
|    |    |    +--- androidx.annotation:annotation:1.1.0
|    |    |    +--- androidx.core:core:1.1.0 (*)
|    |    |    \--- androidx.collection:collection:1.1.0 (*)
|    |    +--- androidx.vectordrawable:vectordrawable-animated:1.1.0
|    |    |    +--- androidx.vectordrawable:vectordrawable:1.1.0 (*)
|    |    |    +--- androidx.interpolator:interpolator:1.0.0
|    |    |    |    \--- androidx.annotation:annotation:1.0.0 -> 1.1.0
|    |    |    \--- androidx.collection:collection:1.1.0 (*)
|    |    \--- androidx.collection:collection:1.0.0 -> 1.1.0 (*)
|    +--- androidx.drawerlayout:drawerlayout:1.0.0
|    |    +--- androidx.annotation:annotation:1.0.0 -> 1.1.0
|    |    +--- androidx.core:core:1.0.0 -> 1.1.0 (*)
|    |    \--- androidx.customview:customview:1.0.0 (*)
|    \--- androidx.collection:collection:1.0.0 -> 1.1.0 (*)

androidx.fragment:fragment

+--- androidx.fragment:fragment:1.1.0
|    +--- androidx.annotation:annotation:1.1.0
|    +--- androidx.core:core:1.1.0 (*)
|    +--- androidx.collection:collection:1.1.0 (*)
|    +--- androidx.viewpager:viewpager:1.0.0
|    |    +--- androidx.annotation:annotation:1.0.0 -> 1.1.0
|    |    +--- androidx.core:core:1.0.0 -> 1.1.0 (*)
|    |    \--- androidx.customview:customview:1.0.0
|    |         +--- androidx.annotation:annotation:1.0.0 -> 1.1.0
|    |         \--- androidx.core:core:1.0.0 -> 1.1.0 (*)
|    +--- androidx.loader:loader:1.0.0
|    |    +--- androidx.annotation:annotation:1.0.0 -> 1.1.0
|    |    +--- androidx.core:core:1.0.0 -> 1.1.0 (*)
|    |    +--- androidx.lifecycle:lifecycle-livedata:2.0.0
|    |    |    +--- androidx.arch.core:core-runtime:2.0.0
|    |    |    |    +--- androidx.annotation:annotation:1.0.0 -> 1.1.0
|    |    |    |    \--- androidx.arch.core:core-common:2.0.0 -> 2.1.0 (*)
|    |    |    +--- androidx.lifecycle:lifecycle-livedata-core:2.0.0
|    |    |    |    +--- androidx.lifecycle:lifecycle-common:2.0.0 -> 2.1.0 (*)
|    |    |    |    +--- androidx.arch.core:core-common:2.0.0 -> 2.1.0 (*)
|    |    |    |    \--- androidx.arch.core:core-runtime:2.0.0 (*)
|    |    |    \--- androidx.arch.core:core-common:2.0.0 -> 2.1.0 (*)
|    |    \--- androidx.lifecycle:lifecycle-viewmodel:2.0.0 -> 2.1.0
|    |         \--- androidx.annotation:annotation:1.1.0
|    +--- androidx.activity:activity:1.0.0
|    |    +--- androidx.annotation:annotation:1.1.0
|    |    +--- androidx.core:core:1.1.0 (*)
|    |    +--- androidx.lifecycle:lifecycle-runtime:2.1.0 (*)
|    |    +--- androidx.lifecycle:lifecycle-viewmodel:2.1.0 (*)
|    |    \--- androidx.savedstate:savedstate:1.0.0
|    |         +--- androidx.annotation:annotation:1.1.0
|    |         +--- androidx.arch.core:core-common:2.0.1 -> 2.1.0 (*)
|    |         \--- androidx.lifecycle:lifecycle-common:2.0.0 -> 2.1.0 (*)
|    \--- androidx.lifecycle:lifecycle-viewmodel:2.0.0 -> 2.1.0 (*)

androidx.activity:activity

+--- androidx.activity:activity:1.0.0
|    +--- androidx.annotation:annotation:1.1.0
|    +--- androidx.core:core:1.1.0
|    |    +--- androidx.lifecycle:lifecycle-runtime:2.0.0 -> 2.1.0
|    |    |    +--- androidx.lifecycle:lifecycle-common:2.1.0
|    |    |    |    \--- androidx.annotation:annotation:1.1.0
|    |    |    +--- androidx.arch.core:core-common:2.1.0
|    |    |    |    \--- androidx.annotation:annotation:1.1.0
|    |    |    \--- androidx.annotation:annotation:1.1.0
|    |    +--- androidx.versionedparcelable:versionedparcelable:1.1.0
|    |    |    \--- androidx.collection:collection:1.0.0
|    |    \--- androidx.collection:collection:1.0.0
|    +--- androidx.lifecycle:lifecycle-runtime:2.1.0 (*)
|    +--- androidx.lifecycle:lifecycle-viewmodel:2.1.0
|    |    \--- androidx.annotation:annotation:1.1.0
|    \--- androidx.savedstate:savedstate:1.0.0
|         +--- androidx.annotation:annotation:1.1.0
|         +--- androidx.arch.core:core-common:2.0.1 -> 2.1.0 (*)
|         \--- androidx.lifecycle:lifecycle-common:2.0.0 -> 2.1.0 (*)

androidx.recyclerview:recyclerview

+--- androidx.recyclerview:recyclerview:1.0.0
|    +--- androidx.annotation:annotation:1.0.0
|    +--- androidx.core:core:1.0.0
|    |    +--- androidx.annotation:annotation:1.0.0
|    |    +--- androidx.collection:collection:1.0.0
|    |    |    \--- androidx.annotation:annotation:1.0.0
|    |    +--- 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
|    |    \--- androidx.versionedparcelable:versionedparcelable:1.0.0
|    |         +--- androidx.annotation:annotation:1.0.0
|    |         \--- androidx.collection:collection:1.0.0 (*)
|    \--- androidx.legacy:legacy-support-core-ui:1.0.0
|         +--- androidx.annotation:annotation:1.0.0
|         +--- androidx.core:core:1.0.0 (*)
|         +--- androidx.legacy:legacy-support-core-utils:1.0.0
|         |    +--- androidx.annotation:annotation:1.0.0
|         |    +--- androidx.core:core:1.0.0 (*)
|         |    +--- androidx.documentfile:documentfile:1.0.0
|         |    |    \--- androidx.annotation:annotation:1.0.0
|         |    +--- androidx.loader:loader:1.0.0
|         |    |    +--- androidx.annotation:annotation:1.0.0
|         |    |    +--- androidx.core:core:1.0.0 (*)
|         |    |    +--- androidx.lifecycle:lifecycle-livedata:2.0.0
|         |    |    |    +--- androidx.arch.core:core-runtime:2.0.0
|         |    |    |    |    +--- androidx.annotation:annotation:1.0.0
|         |    |    |    |    \--- 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
|         |    +--- androidx.localbroadcastmanager:localbroadcastmanager:1.0.0
|         |    |    \--- androidx.annotation:annotation:1.0.0
|         |    \--- androidx.print:print:1.0.0
|         |         \--- androidx.annotation:annotation:1.0.0
|         +--- androidx.customview:customview:1.0.0
|         |    +--- androidx.annotation:annotation:1.0.0
|         |    \--- androidx.core:core:1.0.0 (*)
|         +--- androidx.viewpager:viewpager:1.0.0
|         |    +--- androidx.annotation:annotation:1.0.0
|         |    +--- androidx.core:core:1.0.0 (*)
|         |    \--- androidx.customview:customview:1.0.0 (*)
|         +--- androidx.coordinatorlayout:coordinatorlayout:1.0.0
|         |    +--- androidx.annotation:annotation:1.0.0
|         |    +--- androidx.core:core:1.0.0 (*)
|         |    \--- androidx.customview:customview:1.0.0 (*)
|         +--- androidx.drawerlayout:drawerlayout:1.0.0
|         |    +--- androidx.annotation:annotation:1.0.0
|         |    +--- androidx.core:core:1.0.0 (*)
|         |    \--- androidx.customview:customview:1.0.0 (*)
|         +--- androidx.slidingpanelayout:slidingpanelayout:1.0.0
|         |    +--- androidx.annotation:annotation:1.0.0
|         |    +--- androidx.core:core:1.0.0 (*)
|         |    \--- androidx.customview:customview:1.0.0 (*)
|         +--- androidx.interpolator:interpolator:1.0.0
|         |    \--- androidx.annotation:annotation:1.0.0
|         +--- androidx.swiperefreshlayout:swiperefreshlayout:1.0.0
|         |    +--- androidx.annotation:annotation:1.0.0
|         |    +--- androidx.core:core:1.0.0 (*)
|         |    \--- androidx.interpolator:interpolator:1.0.0 (*)
|         +--- androidx.asynclayoutinflater:asynclayoutinflater:1.0.0
|         |    +--- androidx.annotation:annotation:1.0.0
|         |    \--- androidx.core:core:1.0.0 (*)
|         \--- androidx.cursoradapter:cursoradapter:1.0.0
|              \--- androidx.annotation:annotation:1.0.0

androidx.cardview:cardview

+--- androidx.cardview:cardview:1.0.0 (*)
\--- androidx.annotation:annotation:1.0.0 -> 1.1.0

androidx.constraintlayout:constraintlayout

+--- androidx.constraintlayout:constraintlayout:1.1.3
|    \--- androidx.constraintlayout:constraintlayout-solver:1.1.3

androidx.coordinatorlayout:coordinatorlayout

+--- androidx.coordinatorlayout:coordinatorlayout:1.0.0
|    +--- androidx.annotation:annotation:1.0.0
|    +--- androidx.core:core:1.0.0
|    |    +--- androidx.annotation:annotation:1.0.0
|    |    +--- androidx.collection:collection:1.0.0
|    |    |    \--- androidx.annotation:annotation:1.0.0
|    |    +--- 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
|    |    \--- androidx.versionedparcelable:versionedparcelable:1.0.0
|    |         +--- androidx.annotation:annotation:1.0.0
|    |         \--- androidx.collection:collection:1.0.0 (*)
|    \--- androidx.customview:customview:1.0.0
|         +--- androidx.annotation:annotation:1.0.0
|         \--- androidx.core:core:1.0.0 (*)

com.google.android.material:material

+--- com.google.android.material:material:1.0.0
|    +--- androidx.annotation:annotation:1.0.0
|    +--- androidx.core:core:1.0.0
|    |    +--- androidx.annotation:annotation:1.0.0
|    |    +--- androidx.collection:collection:1.0.0
|    |    |    \--- androidx.annotation:annotation:1.0.0
|    |    +--- 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
|    |    \--- androidx.versionedparcelable:versionedparcelable:1.0.0
|    |         +--- androidx.annotation:annotation:1.0.0
|    |         \--- androidx.collection:collection:1.0.0 (*)
|    +--- androidx.legacy:legacy-support-core-ui:1.0.0
|    |    +--- androidx.annotation:annotation:1.0.0
|    |    +--- androidx.core:core:1.0.0 (*)
|    |    +--- androidx.legacy:legacy-support-core-utils:1.0.0
|    |    |    +--- androidx.annotation:annotation:1.0.0
|    |    |    +--- androidx.core:core:1.0.0 (*)
|    |    |    +--- androidx.documentfile:documentfile:1.0.0
|    |    |    |    \--- androidx.annotation:annotation:1.0.0
|    |    |    +--- androidx.loader:loader:1.0.0
|    |    |    |    +--- androidx.annotation:annotation:1.0.0
|    |    |    |    +--- androidx.core:core:1.0.0 (*)
|    |    |    |    +--- androidx.lifecycle:lifecycle-livedata:2.0.0
|    |    |    |    |    +--- androidx.arch.core:core-runtime:2.0.0
|    |    |    |    |    |    +--- androidx.annotation:annotation:1.0.0
|    |    |    |    |    |    \--- 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
|    |    |    +--- androidx.localbroadcastmanager:localbroadcastmanager:1.0.0
|    |    |    |    \--- androidx.annotation:annotation:1.0.0
|    |    |    \--- androidx.print:print:1.0.0
|    |    |         \--- androidx.annotation:annotation:1.0.0
|    |    +--- androidx.customview:customview:1.0.0
|    |    |    +--- androidx.annotation:annotation:1.0.0
|    |    |    \--- androidx.core:core:1.0.0 (*)
|    |    +--- androidx.viewpager:viewpager:1.0.0
|    |    |    +--- androidx.annotation:annotation:1.0.0
|    |    |    +--- androidx.core:core:1.0.0 (*)
|    |    |    \--- androidx.customview:customview:1.0.0 (*)
|    |    +--- androidx.coordinatorlayout:coordinatorlayout:1.0.0
|    |    |    +--- androidx.annotation:annotation:1.0.0
|    |    |    +--- androidx.core:core:1.0.0 (*)
|    |    |    \--- androidx.customview:customview:1.0.0 (*)
|    |    +--- androidx.drawerlayout:drawerlayout:1.0.0
|    |    |    +--- androidx.annotation:annotation:1.0.0
|    |    |    +--- androidx.core:core:1.0.0 (*)
|    |    |    \--- androidx.customview:customview:1.0.0 (*)
|    |    +--- androidx.slidingpanelayout:slidingpanelayout:1.0.0
|    |    |    +--- androidx.annotation:annotation:1.0.0
|    |    |    +--- androidx.core:core:1.0.0 (*)
|    |    |    \--- androidx.customview:customview:1.0.0 (*)
|    |    +--- androidx.interpolator:interpolator:1.0.0
|    |    |    \--- androidx.annotation:annotation:1.0.0
|    |    +--- androidx.swiperefreshlayout:swiperefreshlayout:1.0.0
|    |    |    +--- androidx.annotation:annotation:1.0.0
|    |    |    +--- androidx.core:core:1.0.0 (*)
|    |    |    \--- androidx.interpolator:interpolator:1.0.0 (*)
|    |    +--- androidx.asynclayoutinflater:asynclayoutinflater:1.0.0
|    |    |    +--- androidx.annotation:annotation:1.0.0
|    |    |    \--- androidx.core:core:1.0.0 (*)
|    |    \--- androidx.cursoradapter:cursoradapter:1.0.0
|    |         \--- androidx.annotation:annotation:1.0.0
|    +--- androidx.legacy:legacy-support-core-utils:1.0.0 (*)
|    +--- androidx.fragment:fragment:1.0.0
|    |    +--- androidx.core:core:1.0.0 (*)
|    |    +--- androidx.legacy:legacy-support-core-ui:1.0.0 (*)
|    |    +--- androidx.legacy:legacy-support-core-utils:1.0.0 (*)
|    |    +--- androidx.annotation:annotation:1.0.0
|    |    +--- androidx.loader:loader:1.0.0 (*)
|    |    \--- androidx.lifecycle:lifecycle-viewmodel:2.0.0 (*)
|    +--- androidx.transition:transition:1.0.0
|    |    +--- androidx.annotation:annotation:1.0.0
|    |    \--- androidx.core:core:1.0.0 (*)
|    +--- androidx.appcompat:appcompat:1.0.0
|    |    +--- androidx.annotation:annotation:1.0.0
|    |    +--- androidx.core:core:1.0.0 (*)
|    |    +--- androidx.collection:collection:1.0.0 (*)
|    |    +--- androidx.cursoradapter:cursoradapter:1.0.0 (*)
|    |    +--- androidx.legacy:legacy-support-core-utils:1.0.0 (*)
|    |    +--- androidx.fragment:fragment:1.0.0 (*)
|    |    +--- androidx.vectordrawable:vectordrawable:1.0.0
|    |    |    +--- androidx.annotation:annotation:1.0.0
|    |    |    \--- androidx.core:core:1.0.0 (*)
|    |    \--- androidx.vectordrawable:vectordrawable-animated:1.0.0
|    |         +--- androidx.vectordrawable:vectordrawable:1.0.0 (*)
|    |         \--- androidx.legacy:legacy-support-core-ui:1.0.0 (*)
|    +--- androidx.cardview:cardview:1.0.0
|    |    \--- androidx.annotation:annotation:1.0.0
|    \--- androidx.recyclerview:recyclerview:1.0.0
|         +--- androidx.annotation:annotation:1.0.0
|         +--- androidx.core:core:1.0.0 (*)
|         \--- androidx.legacy:legacy-support-core-ui:1.0.0 (*)

androidx.viewpager2:viewpager2

+--- androidx.viewpager2:viewpager2:1.0.0-beta05
|    +--- androidx.annotation:annotation:1.1.0
|    +--- androidx.fragment:fragment:1.1.0 (*)
|    +--- androidx.recyclerview:recyclerview:1.1.0-beta05 (*)
|    +--- androidx.core:core:1.1.0 (*)
|    \--- androidx.collection:collection:1.1.0 (*)

androidx.localbroadcastmanager:localbroadcastmanager

+--- androidx.localbroadcastmanager:localbroadcastmanager:1.0.0 (*)

androidx.exifinterface:exifinterface

+--- androidx.exifinterface:exifinterface:1.0.0
|    \--- androidx.annotation:annotation:1.0.0 -> 1.1.0

androidx.test.ext:junit

+--- androidx.test.ext:junit:1.1.1
|    +--- junit:junit:4.12
|    |    \--- org.hamcrest:hamcrest-core:1.3
|    +--- androidx.test:core:1.2.0
|    |    +--- androidx.annotation:annotation:1.0.0
|    |    +--- androidx.test:monitor:1.2.0
|    |    |    \--- androidx.annotation:annotation:1.0.0
|    |    \--- androidx.lifecycle:lifecycle-common:2.0.0
|    |         \--- androidx.annotation:annotation:1.0.0
|    +--- androidx.test:monitor:1.2.0 (*)
|    \--- androidx.annotation:annotation:1.0.0

androidx.test.espresso:espresso-core

\--- androidx.test.espresso:espresso-core:3.2.0
     +--- androidx.test:runner:1.2.0
     |    +--- androidx.annotation:annotation:1.0.0
     |    +--- androidx.test:monitor:1.2.0 (*)
     |    +--- junit:junit:4.12 (*)
     |    \--- net.sf.kxml:kxml2:2.3.0
     +--- androidx.test.espresso:espresso-idling-resource:3.2.0
     +--- com.squareup:javawriter:2.1.1
     +--- javax.inject:javax.inject:1
     +--- org.hamcrest:hamcrest-library:1.3
     |    \--- org.hamcrest:hamcrest-core:1.3
     +--- org.hamcrest:hamcrest-integration:1.3
     |    \--- org.hamcrest:hamcrest-library:1.3 (*)
     \--- com.google.code.findbugs:jsr305:2.0.1

从上面可以看出
androidx.appcompat:appcompat:1.1.0这个包, 基本上包含了常用的库, 所以大家默认导入这一个库即可, 其他的库按需加载就行.
com.google.android.material:material:1.0.0这个包, 包含了常用的库常用的UI库, 导入这一个, 啥都有了.

更多的依赖关系, 可以执行命令 gradlew app:dependencies 查看.


群内有各(pian)种(ni)各(jin)样(qun)的大佬,等你来撩.

联系作者

点此QQ对话 该死的空格 点此快速加群

Android--›迁移到AndroidX指南(含包依赖关系)_第2张图片

Android--›迁移到AndroidX指南(含包依赖关系)_第3张图片

你可能感兴趣的:(Android)