侧边栏壁纸
博主头像
Gstory's Blog博主等级

每天进步一点点!

  • 累计撰写 108 篇文章
  • 累计创建 23 个标签
  • 累计收到 11 条评论

目 录CONTENT

文章目录

Android使用AndroidX及新旧类库对照

gstory
2019-02-12 / 0 评论 / 0 点赞 / 206 阅读 / 13499 字 / 正在检测是否收录...
温馨提示:
本文最后更新于 2023-10-08,若内容或图片失效,请留言反馈。部分素材来自网络,若不小心影响到您的利益,请联系我们删除。

按照官方文档说明 AndroidX 是对 android.support.xxx 包的整理后产物。由于之前的 support 包过于混乱,所以,Google 推出了AndroidX。

前提条件

执行迁移之前,请先将应用更新到最新版本。 我们建议您将项目更新为使用支持库的最终版本:版本 28.0.0。 这是因为,1.0.0 版本的 AndroidX 工件是与支持库 28.0.0 工件等效的二进制文件。

使用 Android Studio 迁移现有项目

使用 Android Studio 3.2 及更高版本,您只需从菜单栏中依次选择 Refactor > Migrate to AndroidX,即可将现有项目迁移到 AndroidX。

重构命令使用两个标记。默认情况下,这两个标记在 gradle.properties 文件中都设为 true:

android.useAndroidX=true
Android 插件会使用对应的 AndroidX 库而非支持库。
android.enableJetifier=true
Android 插件会通过重写现有第三方库的二进制文件,自动将这些库迁移为使用 AndroidX。

新旧类库对照

android.arch.core:commonandroidx.arch.core:core-common
android.arch.core:coreandroidx.arch.core:core
android.arch.core:core-testingandroidx.arch.core:core-testing
android.arch.core:runtimeandroidx.arch.core:core-runtime
android.arch.lifecycle:commonandroidx.lifecycle:lifecycle-common
android.arch.lifecycle:common-java8androidx.lifecycle:lifecycle-common-java8
android.arch.lifecycle:compilerandroidx.lifecycle:lifecycle-compiler
android.arch.lifecycle:extensionsandroidx.lifecycle:lifecycle-extensions
android.arch.lifecycle:livedataandroidx.lifecycle:lifecycle-livedata
android.arch.lifecycle:livedata-coreandroidx.lifecycle:lifecycle-livedata-core
android.arch.lifecycle:reactivestreamsandroidx.lifecycle:lifecycle-reactivestreams
android.arch.lifecycle:runtimeandroidx.lifecycle:lifecycle-runtime
android.arch.lifecycle:viewmodelandroidx.lifecycle:lifecycle-viewmodel
android.arch.paging:commonandroidx.paging:paging-common
android.arch.paging:runtimeandroidx.paging:paging-runtime
android.arch.paging:rxjava2androidx.paging:paging-rxjava2
android.arch.persistence.room:commonandroidx.room:room-common
android.arch.persistence.room:compilerandroidx.room:room-compiler
android.arch.persistence.room:guavaandroidx.room:room-guava
android.arch.persistence.room:migrationandroidx.room:room-migration
android.arch.persistence.room:runtimeandroidx.room:room-runtime
android.arch.persistence.room:rxjava2androidx.room:room-rxjava2
android.arch.persistence.room:testingandroidx.room:room-testing
android.arch.persistence:dbandroidx.sqlite:sqlite
android.arch.persistence:db-frameworkandroidx.sqlite:sqlite-framework
com.android.support.constraint:constraint-layoutandroidx.constraintlayout:constraintlayout
com.android.support.constraint:constraint-layout-solverandroidx.constraintlayout:constraintlayout-solver
com.android.support.test.espresso.idling:idling-concurrentandroidx.test.espresso.idling:idling-concurrent
com.android.support.test.espresso.idling:idling-netandroidx.test.espresso.idling:idling-net
com.android.support.test.espresso:espresso-accessibilityandroidx.test.espresso:espresso-accessibility
com.android.support.test.espresso:espresso-contribandroidx.test.espresso:espresso-contrib
com.android.support.test.espresso:espresso-coreandroidx.test.espresso:espresso-core
com.android.support.test.espresso:espresso-idling-resourceandroidx.test.espresso:espresso-idling-resource
com.android.support.test.espresso:espresso-intentsandroidx.test.espresso:espresso-intents
com.android.support.test.espresso:espresso-remoteandroidx.test.espresso:espresso-remote
com.android.support.test.espresso:espresso-webandroidx.test.espresso:espresso-web
com.android.support.test.janktesthelper:janktesthelperandroidx.test.jank:janktesthelper
com.android.support.test.services:test-servicesandroidx.test:test-services
com.android.support.test.uiautomator:uiautomatorandroidx.test.uiautomator:uiautomator
com.android.support.test:monitorandroidx.test:monitor
com.android.support.test:orchestratorandroidx.test:orchestrator
com.android.support.test:rulesandroidx.test:rules
com.android.support.test:runnerandroidx.test:runner
com.android.support:animated-vector-drawableandroidx.vectordrawable:vectordrawable-animated
com.android.support:appcompat-v7androidx.appcompat:appcompat
com.android.support:asynclayoutinflaterandroidx.asynclayoutinflater:asynclayoutinflater
com.android.support:carandroidx.car:car-alpha5
com.android.support:cardview-v7androidx.cardview:cardview
com.android.support:collectionsandroidx.collection:collection
com.android.support:coordinatorlayoutandroidx.coordinatorlayout:coordinatorlayout
com.android.support:cursoradapterandroidx.cursoradapter:cursoradapter
com.android.support:customtabsandroidx.browser:browser
com.android.support:customviewandroidx.customview:customview
com.android.support:design com.google.android.material:material-rc01
com.android.support:documentfileandroidx.documentfile:documentfile
com.android.support:drawerlayoutandroidx.drawerlayout:drawerlayout
com.android.support:exifinterfaceandroidx.exifinterface:exifinterface
com.android.support:gridlayout-v7androidx.gridlayout:gridlayout
com.android.support:heifwriterandroidx.heifwriter:heifwriter
com.android.support:interpolatorandroidx.interpolator:interpolator
com.android.support:leanback-v17androidx.leanback:leanback
com.android.support:loaderandroidx.loader:loader
com.android.support:localbroadcastmanagerandroidx.localbroadcastmanager:localbroadcastmanager
com.android.support:media2androidx.media2:media2-alpha03
com.android.support:media2-exoplayerandroidx.media2:media2-exoplayer-alpha01
com.android.support:mediarouter-v7androidx.mediarouter:mediarouter
com.android.support:multidexandroidx.multidex:multidex
com.android.support:multidex-instrumentationandroidx.multidex:multidex-instrumentation
com.android.support:palette-v7androidx.palette:palette
com.android.support:percentandroidx.percentlayout:percentlayout
com.android.support:preference-leanback-v17androidx.leanback:leanback-preference
com.android.support:preference-v14androidx.legacy:legacy-preference-v14
com.android.support:preference-v7androidx.preference:preference
com.android.support:printandroidx.print:print
com.android.support:recommendationandroidx.recommendation:recommendation
com.android.support:recyclerview-selectionandroidx.recyclerview:recyclerview-selection
com.android.support:recyclerview-v7androidx.recyclerview:recyclerview
com.android.support:slices-buildersandroidx.slice:slice-builders
com.android.support:slices-coreandroidx.slice:slice-core
com.android.support:slices-viewandroidx.slice:slice-view
com.android.support:slidingpanelayoutandroidx.slidingpanelayout:slidingpanelayout
com.android.support:support-annotationsandroidx.annotation:annotation
com.android.support:support-compatandroidx.core:core
com.android.support:support-contentandroidx.contentpager:contentpager
com.android.support:support-core-uiandroidx.legacy:legacy-support-core-ui
com.android.support:support-core-utilsandroidx.legacy:legacy-support-core-utils
com.android.support:support-dynamic-animationandroidx.dynamicanimation:dynamicanimation
com.android.support:support-emojiandroidx.emoji:emoji
com.android.support:support-emoji-appcompatandroidx.emoji:emoji-appcompat
com.android.support:support-emoji-bundledandroidx.emoji:emoji-bundled
com.android.support:support-fragmentandroidx.fragment:fragment
com.android.support:support-media-compatandroidx.media:media
com.android.support:support-tv-providerandroidx.tvprovider:tvprovider
com.android.support:support-v13androidx.legacy:legacy-support-v13
com.android.support:support-v4androidx.legacy:legacy-support-v4
com.android.support:support-vector-drawableandroidx.vectordrawable:vectordrawable
com.android.support:swiperefreshlayoutandroidx.swiperefreshlayout:swiperefreshlayout
com.android.support:textclassifierandroidx.textclassifier:textclassifier
com.android.support:transitionandroidx.transition:transition
com.android.support:versionedparcelableandroidx.versionedparcelable:versionedparcelable
com.android.support:viewpagerandroidx.viewpager:viewpager
com.android.support:wearandroidx.wear:wear
com.android.support:webkitandroidx.webkit:webkit

官方文档

可以到官方文档查看详细信息

0

评论区