一、如下提示
Version 28 (intended for Android Pie and below) is the last version of the
legacy support library, so we recommend that you migrate to AndroidX libraries
when using Android Q and moving forward. The IDE can help with this: Refactor
> Migrate to AndroidX... less... (Ctrl+F1)
Inspection info:There are some combinations of libraries, or tools and libraries,
that are incompatible, or can lead to bugs. One such incompatibility is compiling
with a version of the Android support libraries that is not the latest version
(or in particular, a version lower than your targetSdkVersion).
Issue id: GradleCompatible
二、报错原因:
1、由于Android Studio 版本较高,添加库依赖已经不支持compile语句,应使用implementation或者api.
2、若使用api或implementation语句仍然报错,可能是库的版本较低,出现了不兼容的现象。
3、由于原来的support 库太乱了,谷歌在新版本中取消了support库,使用了新的andriodX库。
三、为了解决上述问题,我们需要将原理的support库迁移到AndroidX并使用implementation添加依赖。
四、类映射,下表列出了从旧支持库软件包到新 androidx
软件包的当前映射关系。您也可以下载包含这些映射信息的 CSV 格式文件。
详细的类映射https://developer.android.google.cn/jetpack/androidx/migrate/class-mappings#androidsupportv7
五、参考文章
1、https://www.freesion.com/article/2023437918/