所有 android 个支持库必须使用相同的版本规范

All android support libraries must use the same version specification

我不知道我哪里错了,但这让我一直在说

All com.android.support libraries must use the same exact version specification (mixing versions can lead to runtime crashes.) Found versions 24.0.0,23.2.0 Examples include com.android.support:animated-vector-drawable:24.0.0 and com.android.support:cardview-v7:23.2.0

我的 build.gradle 是

        apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion '25.0.0'

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

allprojects {
    gradle.projectsEvaluated {
        tasks.withType(JavaCompile) {
            options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.parse.bolts:bolts-android:1.+'
    compile 'com.parse:parse-android:1.+'
    compile 'com.android.support:appcompat-v7:23.2.0'
    compile 'com.android.support:design:23.2.0'
    compile 'com.android.support:recyclerview-v7:23.2.0'
    compile 'com.android.support:cardview-v7:23.2.0'
    compile 'com.squareup.picasso:picasso:2.5.2'
    compile 'com.mani:ThinDownloadManager:1.2.2'
    compile 'net.rdrei.android.dirchooser:library:3.2@aar'
    compile 'com.google.android.gms:play-services:10.2.0'
    compile 'com.onesignal:OneSignal:3.+@aar'

}
apply plugin: 'com.google.gms.google-services'

这一行也显示错误

compile 'com.android.support:appcompat-v7:23.2.0'

我也尝试将 compileSdkVersion 更改为 24,但目前似乎没有任何效果。实际上在我引入 play 服务库之前一切正常。

此依赖项使用 com.android.support:animated-vector-drawable:

的 24.0.0 版
compile 'com.google.android.gms:play-services:10.2.0'

这将导致 android 工作室抱怨它可能导致 bugs/crashes,因为所有 google 库的版本都不匹配。

所以你有 2 个选择: (我不知道)

  1. 将您的 compileSdkVersion 更改为 24,并将所有支持库依赖项也更改为版本 24 以匹配播放服务依赖项:

    compile 'com.android.support:appcompat-v7:24.0.0'
    compile 'com.android.support:design:24.0.0'
    compile 'com.android.support:recyclerview-v7:24.0.0'
    compile 'com.android.support:cardview-v7:24.0.0'
    
  2. com.google.android.gms:play-services 降级到 9.4 或 9.2.1,这样它就不会使用任何版本 24。这仍然需要将您的支持库从 23.2.0 更改为简单的 23.0.0

    compile 'com.android.support:appcompat-v7:23.0.0'
    compile 'com.android.support:design:23.0.0'
    compile 'com.android.support:recyclerview-v7:23.0.0'
    compile 'com.android.support:cardview-v7:23.0.0'
    compile 'com.google.android.gms:play-services:9.4.0'