&引用;所有com.android.support库必须使用完全相同的版本规范;编译android.support时:appcompat-v7:25.2.0

&引用;所有com.android.support库必须使用完全相同的版本规范;编译android.support时:appcompat-v7:25.2.0,android,android-studio,gradle,Android,Android Studio,Gradle,将Android Studio更新到3.1.2版后,我的应用程序build.gradle中出现错误: 所有com.android.support库必须使用完全相同的版本规范(…)。找到版本28.0.0-alpha1、26.1.0。示例包括com.android.support:AsyncLayoutFlater:28.0.0-alpha1和com.android.support:AnimatedVector drawable:26.1.0 这是我的格拉德尔: apply plugin: 'com

将Android Studio更新到3.1.2版后,我的应用程序build.gradle中出现错误:

所有com.android.support库必须使用完全相同的版本规范(…)。找到版本28.0.0-alpha1、26.1.0。示例包括com.android.support:AsyncLayoutFlater:28.0.0-alpha1和com.android.support:AnimatedVector drawable:26.1.0

这是我的格拉德尔:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 25
    buildToolsVersion '27.0.3'
    defaultConfig {
        applicationId "org.hopto.****.musicplayer"
        minSdkVersion 23
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
        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:appcompat-v7:25.2.0'
    compile 'com.android.support:design:25.2.0'
    compile 'com.cleveroad:audiowidget:0.9.0'
    compile 'com.google.android.gms:play-services-ads:10.2.0'
    compile 'com.android.support:recyclerview-v7:+'
    testCompile 'junit:junit:4.12'
}
我尝试通过添加以下行来解决此问题:

compile 'com.android.support:asynclayoutinflater:25.0.0'
compile 'com.android.support:animated-vector-drawable:25.0.0'

我也尝试过使用不同的版本,例如25.2.0和25+,但都不起作用。

您正在使用以下支持库:

compile 'com.android.support:appcompat-v7:25.2.0'
compile 'com.android.support:design:25.2.0'
compile 'com.android.support:recyclerview-v7:+' //error here
如您所见,您的recyclerview库使用的是可用的最新版本“+”,即28.0.0-alpha1或26.1.0(稳定)。对于其余部分,您使用的是25.2.0,因此错误与版本不匹配

解决方案是将recyclerview版本更改为25.2.0,或将所有内容更改为26.1.0(包括recyclerview)

旁注:应该避免在版本号中使用“+”,因为在库更新时可能会出现意外行为