x的最低实验条件

AndroidStudio 3.2.0+
gradle:gradle-4.6以上
本次实验条件:
AndroidStudio 3.3 (强制要求最低gradle版本为gradle-4.10-all)
gradle:gradle-4.10-all

使用AndroidX

如果要在新项目中使用AndroidX,则需要将compile SDK设置为Android 9.0(API级别28)或更高版本,并在gradle.properties文件中设置以下两个Android Gradle插件标志。

  • android.useAndroidX:设置true为时,Android插件使用相应的AndroidX库而不是支持库。如果未指定,则默认情况下为false标志 。
  • android.enableJetifier:设置true为时,Android插件会自动迁移现有的第三方库,通过重写其二进制文件来使用AndroidX。如果未指定,则默认情况下为false标志。

AndroidX概述

AndroidX是Android团队用于在Jetpack中开发,测试,打包,发布和发布库的开源项目 。
AndroidX是对原始Android 支持库的重大改进 。与支持库一样,AndroidX与Android操作系统分开提供,并提供跨Android版本的向后兼容性。AndroidX通过提供功能奇偶校验和新库完全取代了支持库。此外,AndroidX还包括以下功能:

  • AndroidX中的所有软件包都以字符串开头,位于一致的命名空间androidx中。支持库包已映射到相应的androidx.*包中。有关所有旧类和构建工件的完整映射到新构件,请参阅“ 包重构”页面。
  • 与支持库不同,AndroidX软件包是单独维护和更新的。这些androidx包使用严格的语义版本控制, 从版本1.0.0开始。您可以单独更新项目中的AndroidX库。
  • 所有新的支持库开发都将在AndroidX库中进行。这包括维护原始支持库工件和引入新的Jetpack组件。

其实就是对安卓过往v7,v4,design等系列包的一个整合,不用我们多次添加与核对版本号,大大方便了我们的开发,真的是早就该这样做了。

开始体验x

新建工程有个勾,勾上

9009142-a40dec2d6e24896a.png

创建完成后就会发现gradle.properties多了两行

image.png

这两行的作用主要是自动迁移任何尚未迁移到AndroidX命名空间的Maven依赖项目至AndroidX命名空间,如果是老项目现在想把整个工程其它包替换为androidx包,在手动添加上面这两行后直接使用AS Refactor->Migrate to AndroidX即可。

 

这个时候由于我本地还没有androix这个库,新建工程时的这两个在线引用
implementation 'androidx.appcompat:appcompat:1.0.0-beta01'
implementation 'androidx.constraintlayout:constraintlayout:1.1.2'

也没有引起AS给我自动下载下来androidx整个包,感觉很奇怪,就去官网随便找了一个对应的一个依赖,在线一填,导致它x包所有东西都下载下来了,一切回归正常,在xml和java文件写了好几个以前分布在不同的包的类,没发现什么问题,至此体验结束。
功臣包名:implementation 'com.google.android.material:material:1.0.0-rc01'

旧版本包与AndroidX对照表
旧包 AndroidX
android.arch.core:common androidx.arch.core:core-common:2.0.0-rc01
android.arch.core:core androidx.arch.core:core:2.0.0-rc01
android.arch.core:core-testing androidx.arch.core:core-testing:2.0.0-rc01
android.arch.core:runtime androidx.arch.core:core-runtime:2.0.0-rc01
android.arch.lifecycle:common androidx.lifecycle:lifecycle-common:2.0.0-rc01
android.arch.lifecycle:common-java8 androidx.lifecycle:lifecycle-common-java8:2.0.0-rc01
android.arch.lifecycle:compiler androidx.lifecycle:lifecycle-compiler:2.0.0-rc01
android.arch.lifecycle:extensions androidx.lifecycle:lifecycle-extensions:2.0.0-rc01
android.arch.lifecycle:livedata androidx.lifecycle:lifecycle-livedata:2.0.0-rc01
android.arch.lifecycle:livedata-core androidx.lifecycle:lifecycle-livedata-core:2.0.0-rc01
android.arch.lifecycle:reactivestreams androidx.lifecycle:lifecycle-reactivestreams:2.0.0-rc01
android.arch.lifecycle:runtime androidx.lifecycle:lifecycle-runtime:2.0.0-rc01
android.arch.lifecycle:viewmodel androidx.lifecycle:lifecycle-viewmodel:2.0.0-rc01
android.arch.paging:common androidx.paging:paging-common:2.0.0-rc01
android.arch.paging:runtime androidx.paging:paging-runtime:2.0.0-rc01
android.arch.paging:rxjava2 androidx.paging:paging-rxjava2:2.0.0-rc01
android.arch.persistence.room:common androidx.room:room-common:2.0.0-rc01
android.arch.persistence.room:compiler androidx.room:room-compiler:2.0.0-rc01
android.arch.persistence.room:guava androidx.room:room-guava:2.0.0-rc01
android.arch.persistence.room:migration androidx.room:room-migration:2.0.0-rc01
android.arch.persistence.room:runtime androidx.room:room-runtime:2.0.0-rc01
android.arch.persistence.room:rxjava2 androidx.room:room-rxjava2:2.0.0-rc01
android.arch.persistence.room:testing androidx.room:room-testing:2.0.0-rc01
android.arch.persistence:db androidx.sqlite:sqlite:2.0.0-rc01
android.arch.persistence:db-framework androidx.sqlite:sqlite-framework:2.0.0-rc01
com.android.support.constraint:constraint-layout androidx.constraintlayout:constraintlayout:1.1.2
com.android.support.constraint:constraint-layout-solver androidx.constraintlayout:constraintlayout-solver:1.1.2
com.android.support.test.espresso.idling:idling-concurrent androidx.test.espresso.idling:idling-concurrent:3.1.0
com.android.support.test.espresso.idling:idling-net androidx.test.espresso.idling:idling-net:3.1.0
com.android.support.test.espresso:espresso-accessibility androidx.test.espresso:espresso-accessibility:3.1.0
com.android.support.test.espresso:espresso-contrib androidx.test.espresso:espresso-contrib:3.1.0
com.android.support.test.espresso:espresso-core androidx.test.espresso:espresso-core:3.1.0
com.android.support.test.espresso:espresso-idling-resource androidx.test.espresso:espresso-idling-resource:3.1.0
com.android.support.test.espresso:espresso-intents androidx.test.espresso:espresso-intents:3.1.0
com.android.support.test.espresso:espresso-remote androidx.test.espresso:espresso-remote:3.1.0
com.android.support.test.espresso:espresso-web androidx.test.espresso:espresso-web:3.1.0
com.android.support.test.janktesthelper:janktesthelper androidx.test.jank:janktesthelper:1.0.1
com.android.support.test.services:test-services androidx.test:test-services:1.1.0
com.android.support.test.uiautomator:uiautomator androidx.test.uiautomator:uiautomator:2.2.0
com.android.support.test:monitor androidx.test:monitor:1.1.0
com.android.support.test:orchestrator androidx.test:orchestrator:1.1.0
com.android.support.test:rules androidx.test:rules:1.1.0
com.android.support.test:runner androidx.test:runner:1.1.0
com.android.support:animated-vector-drawable androidx.vectordrawable:vectordrawable-animated:1.0.0
com.android.support:appcompat-v7 androidx.appcompat:appcompat:1.0.0
com.android.support:asynclayoutinflater androidx.asynclayoutinflater:asynclayoutinflater:1.0.0
com.android.support:car androidx.car:car:1.0.0-alpha5
com.android.support:cardview-v7 androidx.cardview:cardview:1.0.0
com.android.support:collections androidx.collection:collection:1.0.0
com.android.support:coordinatorlayout androidx.coordinatorlayout:coordinatorlayout:1.0.0
com.android.support:cursoradapter androidx.cursoradapter:cursoradapter:1.0.0
com.android.support:customtabs androidx.browser:browser:1.0.0
com.android.support:customview androidx.customview:customview:1.0.0
com.android.support:design com.google.android.material:material:1.0.0-rc01
com.android.support:documentfile androidx.documentfile:documentfile:1.0.0
com.android.support:drawerlayout androidx.drawerlayout:drawerlayout:1.0.0
com.android.support:exifinterface androidx.exifinterface:exifinterface:1.0.0
com.android.support:gridlayout-v7 androidx.gridlayout:gridlayout:1.0.0
com.android.support:heifwriter androidx.heifwriter:heifwriter:1.0.0
com.android.support:interpolator androidx.interpolator:interpolator:1.0.0
com.android.support:leanback-v17 androidx.leanback:leanback:1.0.0
com.android.support:loader androidx.loader:loader:1.0.0
com.android.support:localbroadcastmanager androidx.localbroadcastmanager:localbroadcastmanager:1.0.0
com.android.support:media2 androidx.media2:media2:1.0.0-alpha03
com.android.support:media2-exoplayer androidx.media2:media2-exoplayer:1.0.0-alpha01
com.android.support:mediarouter-v7 androidx.mediarouter:mediarouter:1.0.0
com.android.support:multidex androidx.multidex:multidex:2.0.0
com.android.support:multidex-instrumentation androidx.multidex:multidex-instrumentation:2.0.0
com.android.support:palette-v7 androidx.palette:palette:1.0.0
com.android.support:percent androidx.percentlayout:percentlayout:1.0.0
com.android.support:preference-leanback-v17 androidx.leanback:leanback-preference:1.0.0
com.android.support:preference-v14 androidx.legacy:legacy-preference-v14:1.0.0
com.android.support:preference-v7 androidx.preference:preference:1.0.0
com.android.support:print androidx.print:print:1.0.0
com.android.support:recommendation androidx.recommendation:recommendation:1.0.0
com.android.support:recyclerview-selection androidx.recyclerview:recyclerview-selection:1.0.0
com.android.support:recyclerview-v7 androidx.recyclerview:recyclerview:1.0.0
com.android.support:slices-builders androidx.slice:slice-builders:1.0.0
com.android.support:slices-core androidx.slice:slice-core:1.0.0
com.android.support:slices-view androidx.slice:slice-view:1.0.0
com.android.support:slidingpanelayout androidx.slidingpanelayout:slidingpanelayout:1.0.0
com.android.support:support-annotations androidx.annotation:annotation:1.0.0
com.android.support:support-compat androidx.core:core:1.0.0
com.android.support:support-content androidx.contentpager:contentpager:1.0.0
com.android.support:support-core-ui androidx.legacy:legacy-support-core-ui:1.0.0
com.android.support:support-core-utils androidx.legacy:legacy-support-core-utils:1.0.0
com.android.support:support-dynamic-animation androidx.dynamicanimation:dynamicanimation:1.0.0
com.android.support:support-emoji androidx.emoji:emoji:1.0.0
com.android.support:support-emoji-appcompat androidx.emoji:emoji-appcompat:1.0.0
com.android.support:support-emoji-bundled androidx.emoji:emoji-bundled:1.0.0
com.android.support:support-fragment androidx.fragment:fragment:1.0.0
com.android.support:support-media-compat androidx.media:media:1.0.0
com.android.support:support-tv-provider androidx.tvprovider:tvprovider:1.0.0
com.android.support:support-v13 androidx.legacy:legacy-support-v13:1.0.0
com.android.support:support-v4 androidx.legacy:legacy-support-v4:1.0.0
com.android.support:support-vector-drawable androidx.vectordrawable:vectordrawable:1.0.0
com.android.support:swiperefreshlayout androidx.swiperefreshlayout:swiperefreshlayout:1.0.0
com.android.support:textclassifier androidx.textclassifier:textclassifier:1.0.0
com.android.support:transition androidx.transition:transition:1.0.0
com.android.support:versionedparcelable androidx.versionedparcelable:versionedparcelable:1.0.0
com.android.support:viewpager androidx.viewpager:viewpager:1.0.0
com.android.support:wear androidx.wear:wear:1.0.0
com.android.support:webkit androidx.webkit:webkit:1.0.0

参考文章:
【google官方】androix包
【google官方】现有项目迁移教程

Androidx初尝及其新旧包对照表的更多相关文章

  1. 初尝Windows 下批处理编程

    本文叫“ 初尝Windows 下批处理编程”是为了延续上一篇“初尝 Perl”,其实对于博主而言批处理以及批处理编程早就接触过了. 本文包括以下内容 1.什么是批处理 2.常用批处理命令 3.简介批处 ...

  2. .NET领域驱动设计—初尝(三:穿过迷雾走向光明)

    开篇介绍 在开始这篇富有某种奇妙感觉的文章之旅时我们先短暂的讨论一下关于软件开发方法论的简要: 纵观软件开发方法论,从瀑布模型.螺旋模型.RUP(统一软件开发过程).XP(极限编程).Agile(敏捷 ...

  3. Hadoop日记Day15---MapReduce新旧api的比较

    我使用hadoop的是hadoop1.1.2,而很多公司也在使用hadoop0.2x版本,因此市面上的hadoop资料版本不一,为了扩充自己的知识面,MapReduce的新旧api进行了比较研究. h ...

  4. 初尝微信小程序2-Swiper组件、导航栏标题配置

    swiper 滑块视图容器. 很多网页的首页都会有一个滚动的图片模块,比如天猫超市首页,滚动着很多优惠活动的图片,用来介绍优惠内容,以及供用户点击快速跳转到相应页面. Swiper不仅可以滚动图片,也 ...

  5. MapReduce简述、工作流程及新旧API对照

    什么是MapReduce? 你想数出一摞牌中有多少张黑桃.直观方式是一张一张检查而且数出有多少张是黑桃. MapReduce方法则是: 1. 给在座的全部玩家中分配这摞牌. 2. 让每一个玩家数自己手 ...

  6. Github原生CI/CD,初尝Github Actions

    Github 原生 CI/CD,初尝 Github Actions Intro Github 目前已经推出了自己的 CICD 服务 -- Github Actions,而且比微软的 Azure Dev ...

  7. ca33a_demo_c++_新旧代码的兼容char数组与vector_string相互转换

    /*ca33a_demo_c++33_CppPrimer_新旧代码的兼容_txwtech旧代码:数组和c风格字符串新代码:vector和string相互转换:c风格字符串<- ->stri ...

  8. golang快速入门(五)初尝web服务

    提示:本系列文章适合对Go有持续冲动的读者 初探golang web服务 golang web开发是其一项重要且有竞争力的应用,本小结来看看再golang中怎么创建一个简单的web服务. 在不适用we ...

  9. Hugging Face发布diffuser模型AI绘画库初尝鲜!

    作者:韩信子@ShowMeAI 深度学习实战系列:https://www.showmeai.tech/tutorials/42 TensorFlow 实战系列:https://www.showmeai ...

随机推荐

  1. Java基础 try...catch 处理ArithmeticException 除以零的异常

        JDK :OpenJDK-11      OS :CentOS 7.6.1810      IDE :Eclipse 2019‑03 typesetting :Markdown   code ...

  2. Java JDBC利用反射技术将查询结果封装为对象

    1.JDBC将返回结果集封装成对象demo class JdbcDemo { /** * 获取数据库列名 * @param rs * @return */ private static String[ ...

  3. Sword libcurl库CURLE_COULDNT_CONNECT错误

    CURL: CURLE_COULDNT_CONNECT问题分析 测试环境描述在使用libcurl写http客户端进行压力测试的时候会遇到curl_easy_perform()返回CURLE_COULD ...

  4. RabbitMQ整合Spring Booot【Exchange-Fanout模式】

    pom: <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.o ...

  5. [报错处理]Python Requests - No connection adapters

    出错信息很清楚:Python请求 - 没有连接适配器. 你得把网络协议加进入网址: http://192.168.1.61:8080/api/call 没有 http:// 请求不知道如何连接远程. ...

  6. kubernetes-subpath用法(把文件挂载在已存在的目录下,不覆盖原目录)

    以ngxin的配置文件为例子: nginx-deployment.yaml : apiVersion: v1 kind: ConfigMap metadata: name: nginx-cm data ...

  7. C#基于RabbitMQ实现客户端之间消息通讯实战演练

    一.背景介绍和描述 MQ消息队列已经逐渐成为企业IT系统内部通信的核心手段.它具有低耦合.可靠投递.广播.流量控制.最终一致性等一系列功能,成为异步RPC的主要手段之一.何时需要消息队列?当你需要使用 ...

  8. 深入理解-CLI与PHP-FPM

    原文地址:https://blog.csdn.net/lzx_victory/article/details/85917161 PHP-FPM模式相对于CLI比较复杂,因为PHP-FPM为常驻进程不断 ...

  9. linux 软连接 ln -s

    <pre>linux 软连接 ln -sln -s /home/ /home/ss/</pre> 按照win的说法就是创建快捷方式在/home/ss/ 文件夹里(名字就是hom ...

  10. Cookie 允许第三方cookie

    这样本地调线上的接口,就可以使用线上接口生成的cookie了. 或者允许,或者增加白名单.