我正在通过观看Youtube上的一些教程学习编写Android应用程序。我跟着教程尝试在xml文件中添加recyclerview。当我点击recyclerview旁边的下载按钮时,会显示以下消息:
"This operation requires the library androidx.recyclerview:recyclerview:+.
问题: 找到现有项目依赖项中的不一致性。 版本不兼容: - androidx.appcompat: appcompat:1.1.0@aar 和: - androidx.core: core-ktx:1.1.0@aar 使用依赖项: - androidx.annotation::1.1.0 与: - androidx.annotation::2.0.0
添加此库后,项目可能无法编译。您仍要添加吗?"
如果我选择“确定”并继续,预览屏幕变为灰色。
我应该如何解决这个问题?
当我想在xml文件中添加cardview时,也会出现同样的问题。
感谢您的帮助!
build.gradle如下:
"This operation requires the library androidx.recyclerview:recyclerview:+.
问题: 找到现有项目依赖项中的不一致性。 版本不兼容: - androidx.appcompat: appcompat:1.1.0@aar 和: - androidx.core: core-ktx:1.1.0@aar 使用依赖项: - androidx.annotation::1.1.0 与: - androidx.annotation::2.0.0
添加此库后,项目可能无法编译。您仍要添加吗?"
如果我选择“确定”并继续,预览屏幕变为灰色。
我应该如何解决这个问题?
当我想在xml文件中添加cardview时,也会出现同样的问题。
感谢您的帮助!
build.gradle如下:
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 29
buildToolsVersion "29.0.2"
defaultConfig {
applicationId "com.smartherd.msgshareapp"
minSdkVersion 21
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.core:core-ktx:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}