android - 所有 com.android.support 库必须使用完全相同的版本规范

标签 android gradle android-gradle-plugin android-support-library

我在 build.gradle(模块应用程序)中有一个我无法解决的问题

apply plugin: 'com.android.application'

android {
    compileSdkVersion 25
    buildToolsVersion "25.0.3"
    defaultConfig {
        applicationId "ahmedchtn.smartschool"
        minSdkVersion 17
        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'
    })

    //RecyclerView

    //retrofit,gson

    //glide
    compile 'com.github.bumptech.glide:glide:3.7.0'

    //Displaying images
    compile 'com.github.bumptech.glide:glide:3.7.0'

    compile 'com.android.support:appcompat-v7:23.4.0'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    compile 'com.android.support:support-v7:25.0.3'
    compile 'com.android.support:design:25.3.1'
    compile 'com.android.support:recyclerview-v7:25.3.1'
    compile 'com.google.code.gson:gson:2.6.2'
    compile 'com.squareup.retrofit2:retrofit:2.0.2'
    compile 'com.squareup.retrofit2:converter-gson:2.0.2'
    compile 'com.google.firebase:firebase-database:10.0.1'
    compile 'com.google.firebase:firebase-auth:10.0.1'
    //Firebase UI
    compile 'com.firebaseui:firebase-ui-auth:0.6.0'

    testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'

错误显示在这一行
compile 'com.android.support:appcompat-v7:23.4.0'

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

最佳答案

对支持库的所有依赖项使用相同的版本。在您的情况下,将这些依赖版本更改为“25.3.1”。

compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:support-v7:25.3.1'
compile 'com.android.support:design:25.3.1'
compile 'com.android.support:recyclerview-v7:25.3.1'

关于android - 所有 com.android.support 库必须使用完全相同的版本规范,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45051806/

相关文章:

android - 没有缓存版本的 gradle

android - 如何为 @Nullable 注释启用 Android lint 检查?

android - 使用 NDK 构建迁移到 Gradle Experimental 的问题

Android 应用程序不兼容但列为兼容

java - WiFi 断开时播放音乐

android - 创建一个使用 google play 服务的 Android 库

powershell - Gradle -v 命令指向旧版本

android - 谷歌地图 SphericalUtil 计算偏移

Android Traceview (Sampling based trace) 不反射(reflect)函数调用的实际次数

Android Studio 3.0.1 错误 : Gradle project sync failed. 基本功能(例如编辑、调试)将无法正常工作