无法解决com.android.support.recylerview-v7:23.1.0

时间:2016-08-25 06:32:44

标签: android

apply plugin: 'com.android.application'

android {
compileSdkVersion 23
buildToolsVersion "23.0.3"

defaultConfig {
    applicationId "com.example.sandy.carddemo"
    minSdkVersion 15
    targetSdkVersion 23
    versionCode 1
    versionName "1.0"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
  }
}

dependencies {
 compile fileTree(dir: 'libs', include: ['*.jar'])
 testCompile 'junit:junit:4.12'
 compile ("com.android.support:appcompat-v7:23.1.+")
 compile ("com.android.support.recyclerview-v7:23.1.0")
 compile ("com.android.support.cardview-v7:23.1.0")
}

这是我的app.gradle文件。我已经安装了所有依赖项,但仍然提供了

  

无法解析com.android.support.recylerview-v7:23.1.0

     

无法解析com.android.support.cardview-v7:23.1.0

1 个答案:

答案 0 :(得分:3)

您的依赖声明不正确。而不是:

compile ("com.android.support.recyclerview-v7:23.1.0")
compile ("com.android.support.cardview-v7:23.1.0")

它应该是(添加冒号):

compile ("com.android.support:recyclerview-v7:23.1.0")
compile ("com.android.support:cardview-v7:23.1.0")

因此,它被定义为:

compile ("<groupId>:<artifactId>:<version>")