我将recyclerview版本从23.0.1更改为23.2.1时出现gradle文件错误

时间:2017-12-08 10:17:51

标签: java android android-gradle

apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "25.0.0"
    defaultConfig {
    applicationId "adhoc.mlm_app"
    minSdkVersion 15
    targetSdkVersion 23
    versionCode 4
    versionName "1.0.4"
   testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}
dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
     exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'com.android.support.constraint:constraint-layout:1.0.2'//getting error

    compile 'com.android.support:appcompat-v7:23.2.1'
    compile 'com.android.support:design:23.0.1'
    compile 'com.squareup.picasso:picasso:2.5.2'
    compile 'com.android.support:cardview-v7:23.2.1'
    compile 'com.android.support:recyclerview-v7:23.2.1'
    testCompile 'junit:junit:4.12'
}
  

所有com.android.support库必须使用完全相同的版本   规范(混合版本可能导致运行时崩溃)。发现   版本23.2.1,23.0.1。例子包括   com.android.support:animated-vector-drawable:23.2.1和   com.android.support:design:23.0.1)

2 个答案:

答案 0 :(得分:1)

使用

 compile `'com.android.support:design:23.2.1'` 

而不是

compile 'com.android.support:design:23.0.1'

答案 1 :(得分:0)

使用以下代码更新gradle文件

    dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
     exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'com.android.support.constraint:constraint-layout:1.0.2'

    compile 'com.android.support:appcompat-v7:23.2.1'
    compile 'com.android.support:design:23.2.1'//change here
    compile 'com.squareup.picasso:picasso:2.5.2'
    compile 'com.android.support:cardview-v7:23.2.1'
    compile 'com.android.support:recyclerview-v7:23.2.1'
    testCompile 'junit:junit:4.12'
}