新建 Android 项目是否需要勾选 Use legacy android.support libraries

更新日期: 2022-02-27 阅读次数: 4717 字数: 364 分类: Android

有半年没有新建 Android 项目了,今天在 Android Studio Bumblebee 创建 Empty Activity 项目时,有个选项拦住了我。

Use legacy android.support libraries

什么是 legacy android.support libraries?

对于我这种业余型 Android 选手,一头雾水。

下面的解释:

Using legacy android.support libraries will prevent you from using the latest Play Services and Jetpack libraries

就是说,用了 android.support libraries, 就无法使用最新的 Play 服务,还有 Jetpack 相关的库。 这肯定是我无法接受的,毕竟 Google 一直在推广 Jetpack 相关的新类库,看起来还挺方便。

所以,这个选项对于面向普通用户的新项目来说,一定不要勾选。其没有默认勾选,也是非常合理的。

legacy

中文翻译是遗产。但是在计算机术业中,其代表的是

denoting or relating to software or hardware that has been superseded but is difficult to replace because of its wide use.

即,已被废弃,不再维护。但是又由于其已被广泛使用,无法替代。

新的替代品 AndroidX

android.support 类库已被 AndroidX 替代:

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.

我网上搜索了一下,如果继续使用 android.support 在引入新的类库时,会报错。 尽量不要踩坑。

关于作者 🌱

我是来自山东烟台的一名开发者,有敢兴趣的话题,或者软件开发需求,欢迎加微信 zhongwei 聊聊, 查看更多联系方式