androidx和com.android.support之间的区别 [英] Difference between androidx and com.android.support

查看:697
本文介绍了androidx和com.android.support之间的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我发现可以使用两种不同的依赖项时,我将在项目中使用约束布局:

I was about to use a constraint-layout in my project when I noticed that there are two different dependencies that I can use:

  • com.android.support.constraint:constraint-layout
  • androidx.constraintlayout:constraintlayout
  • com.android.support.constraint:constraint-layout
  • androidx.constraintlayout:constraintlayout

这两个或某些推荐之间是否存在区别?

Is there a difference between these two or some recommendation on which is preferable?

编辑

Google停止了对com.android.support的支持,并提示用户迁移到新的androidx等效项.

Google is stopping support for com.android.support and prompts users to migrate to the new androidx equivalent.

注意:随着Android 9.0(API级别28)的发布,Jetpack包含了一个新版本的支持库AndroidX. AndroidX库包含现有的支持库,还包含最新的Jetpack组件.

Note: With the release of Android 9.0 (API level 28) there is a new version of the support library called AndroidX which is part of Jetpack. The AndroidX library contains the existing support library and also includes the latest Jetpack components.

您可以继续使用支持库.历史工件(那些版本为27和更低版本,并打包为android.support.*的工件)将在Google Maven上可用.但是,所有新的库开发都将在AndroidX库中进行.

You can continue to use the support library. Historical artifacts (those versioned 27 and earlier, and packaged as android.support.*) will remain available on Google Maven. However, all new library development will occur in the AndroidX library.

我们建议在所有新项目中使用AndroidX库.您还应该考虑将现有项目也迁移到AndroidX.

We recommend using the AndroidX libraries in all new projects. You should also consider migrating existing projects to AndroidX as well.

这是官方迁移指南和相应的库等效文件.

Here is the official Migration guide and the corresponding library equivalents.

推荐答案

所有支持库都删除了v4 v7 v12 v13 etc标签,所有内容都重构为androidx包.

All the support libraries are dropping the v4 v7 v12 v13 etc tags and everything is refactored into the androidx packages.

它们在本质上是相同的,但为了将来参考,androidx将是我们应在我们的应用程序中使用的库.

They are essentially the same but for future reference androidx will be the library that we should use in our apps.

本周(2018年5月14日这一周)发布的Android Studio 3.2 Canary应该具有允许自动重构androidx软件包的工具.在Google I/O 2018上有关于此的公告.

Android studio 3.2 canary that comes out this week (week of May 14, 2018) should have the tool that allows automatic refactoring to the androidx packages. There was an announcement about this at google i/o 2018.

这篇关于androidx和com.android.support之间的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆