简体   繁体   中英

support library version issue

I am finding difficulty in upgrading my app. I am getting this error(red underline) in one of the line in build.gradle file (app)

implementation 'com.android.support:appcompat-v7:28.0.0'

Message when i hover on this line:

All com.android.support libraries must use the exact same version specification (mixing versions can lead to runtime crashes). Found versions 28.0.0, 26.1.0. Examples include com.android.support:animated-vector-drawable:28.0.0 and com.android.support:support-media-compat:26.1.0 less... (Ctrl+F1) 
Inspection info:There are some combinations of libraries, or tools and libraries, that are incompatible, or can lead to bugs. One such incompatibility is compiling with a version of the Android support libraries that is not the latest version (or in particular, a version lower than your targetSdkVersion).

My app build.gradle looks as follows:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 28

    defaultConfig {
        applicationId "com.theaskdev.sitmangalore"
        minSdkVersion 21
        targetSdkVersion 28
        versionCode 17
        multiDexEnabled true
        versionName "5.7"
        ndk.abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64'
        signingConfig signingConfigs.release
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    dexOptions {
        javaMaxHeapSize "4g"
    }
    productFlavors {
    }
}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'com.nineoldandroids:library:2.4.0'
    implementation 'com.android.volley:volley:1.1.0'
    implementation 'com.android.support:multidex:1.0.3'
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation "com.android.support:support-compat:28.0.0"
    implementation "com.android.support:support-core-utils:28.0.0"
    implementation 'com.google.firebase:firebase-messaging:17.3.4'
    implementation 'com.google.firebase:firebase-crash:16.2.1'
    implementation 'com.google.firebase:firebase-core:16.0.7'
}


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

My Project build.gradle as follows:

buildscript {
    repositories {
        jcenter()
        google()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.3.1'
        classpath 'com.google.gms:google-services:4.2.0'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
        google()
    }
}

Please someone explain how to fix this version issue. This is one of my serious confusion. I have checked suggested answer. But that didn't fix my issue.

try this in your app\\build.gradle file:

configurations.all {
    resolutionStrategy.eachDependency { DependencyResolveDetails details ->
        if (details.requested.group == 'com.android.support') {
            details.useVersion "28.0.0"
        } else if (details.requested.group == 'com.google.firebase') {
            details.useVersion "16.2.1"
        }
    }
}

complette example

You should also use the gradle-versions-plugin to get the latest version of your dependencies.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM