Android 依赖报错Version 28 (intended for Android Pie and below) is the last version of the legacy

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语句仍然报错,可能是库的版本较低,出现了不兼容的现象。

关于报错信息大概意思:
依赖库28号版本是Android Pie 以及以下的版本最新的一个版本,对于Android Q以及以上版本应使用AndroidX库。由于support 库太乱了,谷歌在新版本中取消了support库,使用了新的andriodX库。

Android 依赖报错Version 28 (intended for Android Pie and below) is the last version of the legacy_第1张图片

解决方案如下:
Refactor->Migrate to AndroidX->点击左下角 Do Refactor
(refactor:n.重构)(Migrate:v.迁移)
解决前:
在这里插入图片描述
解决后:
在这里插入图片描述

你可能感兴趣的:(Android,Android依赖报错)