我正在尝试在我的android studio sdk版本28项目中添加cardview和recyclerview依赖项。在构建项目时,我得到一条消息:“Gradle项目同步失败。基本功能无法正常工作”。
build.gradle(模块:app)文件:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "com.kavyabarnadhyahazarika.quarterallotmentiocl"
        minSdkVersion 16
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
       }
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
buildToolsVersion '28.0.0'
          }

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    implementation 'com.android.support:appcompat-v7:28.0.0-alpha3'
    implementation 'com.android.support:cardview-v7:28.0.0'
    implementation 'com.android.support:recyclerview-v7:28.0.0'
    implementation 'com.mcxiaoke.volley:library:1.0.19'
    testImplementation 'junit:junit:4.12'
}

错误消息:
未能解析:com.android.support:cardview-v7:28.0.0
未能解析:com.android。支持:recyclerview-v7:28.0.0
我试过建筑和清洁工程。
另外,如果sdk version 28不支持这些依赖项,如何解决此问题?

最佳答案

到目前为止还没有最终版本-就像您的依赖关系一样,28.0.0appcompat-v7应该有一个cardview-v7版本:

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

10-07 20:04
查看更多