我在尝试将卡视图和回收器视图依赖项添加到我的应用程序时遇到了上述错误。
以下是我在应用程序级构建中的依赖项.gradle:
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.android.support:support-core-utils:28.0.0'
implementation 'com.android.support:support-media-compat:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.google.firebase:firebase-core:16.0.1'
implementation 'com.android.support:design:28.0.0'
implementation 'com.google.firebase:firebase-database:16.0.1'
implementation 'com.android.support.cardview-v7:28.0.0'
implementation 'com.android.support.recyclerview-v7:28.0.0'
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation 'com.google.firebase:firebase-storage:16.0.1'
implementation 'com.google.firebase:firebase-auth:16.0.1'
}
我相信我在我的项目级buildgradle中已经为存储库提供了相关的输入,如下所示。所以我不确定为什么会出现这个错误。
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
classpath 'com.google.gms:google-services:4.0.1'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
您使用的是句点而不是冒号
implementation.com.android.support.cadv7:28.0.0'
应为
implementation.com.android.support:cardview-v7:28.0.0'
以及您的回收视图:
implementation.com.android.support:recycleerview-v7:28.0.0'
最好的方法是遵循谷歌开发者官方网站:此处
依赖关系应该是:
实现";androidx.cardview:cardview:1.0.0";