Android Studio:An 当我尝试添加 RecyclerView 时显示警告框
Android Studio:An alert box showed when I try to add RecyclerView
警告文字是:
This operation requires the library androidx.recyclerview:recyclerview:+.
Problem: Inconsistencies in the existing project dependencies found.
Version incompatibility between:
- androidx.appcompat:appcompat:1.1.0@aar and:
- androidx.appcompat:appcompat:1.1.0@aar
With the dependency:
- androidx.annotation::1.1.0 versus:
- androidx.annotation::2.0.0
The project may not compile after adding this library. Would you like
to add it anyway
我选择确定后添加了RecyclerView,还是不能用,因为我选择添加的RecyclerView时在Attributes中显示No component selected
将此添加到您的 app.gradle
implementation 'androidx.recyclerview:recyclerview:1.1.0'
implementation 'com.android.support:recyclerview-v7:29.0.0'
或者您可以使用
添加 Google Material 设计库
implementation 'com.google.android.material:material:1.0.0'
因此您可以使用所有 Material 组件,例如 CardView, SnackBar, etc
希望这对您有所帮助!
警告文字是:
This operation requires the library androidx.recyclerview:recyclerview:+.
Problem: Inconsistencies in the existing project dependencies found. Version incompatibility between: - androidx.appcompat:appcompat:1.1.0@aar and: - androidx.appcompat:appcompat:1.1.0@aar
With the dependency: - androidx.annotation::1.1.0 versus: - androidx.annotation::2.0.0
The project may not compile after adding this library. Would you like to add it anyway
我选择确定后添加了RecyclerView,还是不能用,因为我选择添加的RecyclerView时在Attributes中显示No component selected
将此添加到您的 app.gradle
implementation 'androidx.recyclerview:recyclerview:1.1.0'
implementation 'com.android.support:recyclerview-v7:29.0.0'
或者您可以使用
添加 Google Material 设计库implementation 'com.google.android.material:material:1.0.0'
因此您可以使用所有 Material 组件,例如 CardView, SnackBar, etc
希望这对您有所帮助!