是什么取代了 AndroidX 中的 appcompat-v7

What replaced appcompat-v7 in AndroidX

将我的几个旧项目迁移到 AndroidX 后,好像我的三个依赖项已被弃用:

   implementation 'com.android.support:appcompat-v7:28.0.0'
   implementation 'com.android.support:design:28.0.0'
   implementation 'com.android.support:cardview-v7:28.0.0'

我找不到这些依赖项的替代品。

AndroidX 是否具有这些依赖项的等效项?

请参阅迁移指南,Maven artifact mappings,您的工件已在此处列出。

使用顺序:

implementation 'androidx.appcompat:appcompat:1.0.2'   
implementation 'com.google.android.material:material:1.0.0'
implementation 'androidx.cardview:cardview:1.0.0'

如果您想使用 alpha/beta 版本:

implementation 'androidx.appcompat:appcompat:1.1.0-rc01'
implementation 'com.google.android.material:material:1.1.0-alpha09'

有关版本的更多信息:

是的,AndroidX 有新的依赖项。

在您的项目中使用以下实现

implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.cardview:cardview:1.0.0'

而不是

implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:cardview-v7:28.0.0'

有关更多信息,请参阅下文 link :-

并确保在将项目迁移到 androidX 之前。

Steps to migrate Project (Very Easy)

1 : 如果不存在则添加 gradle.properties 文件。并在下面添加行

org.gradle.jvmargs=-Xmx1536M

2 : 转到重构 > 迁移到 Android X

并且不要更改任何内容工作室将自动更新所有内容

新 Android 使用 androidx 设计库:

AppCompat:

implementation 'androidx.appcompat:appcompat:1.2.0'

CardViex:

implementation 'androidx.cardview:cardview:1.0.0'

However be careful because everything is not start with androidx. For example, old design dependency is:

implementation 'com.android.support:design:28.0.0'

Material:

implementation 'com.google.android.material:material:1.1.0'

Recyclerview:

implementation 'androidx.recyclerview:recyclerview:1.2.0'