androidx和com.android.support之间的区别

前端之家收集整理的这篇文章主要介绍了androidx和com.android.support之间的区别前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
当我注意到我可以使用两种不同的依赖项时,我正打算在项目中使用约束布局:

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

这两者之间是否存在差异或哪些建议更可取?

编辑

谷歌正在停止对com.android.support的支持,并提示用户迁移到新的androidx等价物.

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.

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.

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

这是官方的Migration guide和相应的库等价物.

解决方法

所有支持库都放弃了v4 v7 v12 v13等标签,所有内容都重构到了androidx软件包中.

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

本周出现的Android studio 3.2 canary(2018年5月14日那周)应该有允许自动重构androidx软件包的工具.在谷歌i / o 2018上有一个关于这个的公告.

猜你在找的Android相关文章