2

I got the warning at the below line

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

The warning:

All com.android.support libraries must use the exact same version specification 
(mixing versions can lead to runtime crashes). 
Found versions 28.0.0, 24.0.0. 
Examples include com.android.support:animated-vector-drawable:28.0.0 
and com.android.support:mediarouter-v7:24.0.0
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).  
Issue id: GradleCompatible

Below is my build.gradle(app) code (New update for Firebase Libraries)

apply plugin: 'com.android.application'

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "com.vanessa.orderfoodserver"
        minSdkVersion 21
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        multiDexEnabled true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
}


dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])

    //Add Library
    implementation 'com.jaredrummler:material-spinner:1.1.0'

    //Firebase
    implementation 'com.google.firebase:firebase-storage:16.0.5'
    implementation 'com.google.firebase:firebase-auth:16.1.0'
    implementation 'com.firebaseui:firebase-ui-database:4.3.1'
    implementation 'com.google.firebase:firebase-database:16.0.6'
    implementation 'com.google.firebase:firebase-core:16.0.6'

    //Received the warning at below line
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support:support-v4:28.0.0'

    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    implementation 'com.android.support:design:28.0.0'
    implementation 'com.android.support:cardview-v7:28.0.0'
    implementation 'com.android.support:recyclerview-v7:28.0.0'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'

    implementation 'com.squareup.picasso:picasso:2.5.2'
    implementation 'com.rengwuxian.materialedittext:library:2.1.4'

    implementation 'com.google.android.gms:play-services-maps:10.2.0'
    implementation 'com.google.android.gms:play-services:10.2.0' //ForLocation
    testImplementation 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'

I have tried to add

com.android.support:support-v4:28.0.0
com.android.support:animated-vector-drawable:28.0.0
com.android.support:mediarouter-v7:28.0.0

but still the warning still exists.

I can run my app but I still want to fix this warning. Thanks!

Vanessa Leung
  • 770
  • 1
  • 10
  • 22
  • 1
    it one of the library that you have added is using older version, you need to update it. – karan Jan 30 '19 at 09:13
  • 2
    Possible duplicate of [All com.android.support libraries must use the exact same version specification](https://stackoverflow.com/questions/42374151/all-com-android-support-libraries-must-use-the-exact-same-version-specification) – karan Jan 30 '19 at 09:14
  • @KaranMer Hi, I have checked the Google's Maven Repository: https://dl.google.com/dl/android/maven2/index.html, and update all of my libraries to the latest version, but the warning still exists – Vanessa Leung Jan 30 '19 at 09:15
  • check for the third party libraries they might be causing this, try using their latest version. – karan Jan 30 '19 at 09:17
  • you can also try excluding support package from this libraries by excluding them, add this after you define your dependency. `{ exclude group: 'com.android.support' }` – karan Jan 30 '19 at 09:19
  • @KaranMer Hi, could you specify where to add this line, I've added it at the end of dependencies (inside the bracket), but error pops up. – Vanessa Leung Jan 30 '19 at 09:28
  • first try and comment the each dependency individually that will help you identify which one is causing this error, you can then add this at end of that particular dependency. – karan Jan 30 '19 at 09:32
  • @KaranMer hi, I updated all third party libraries and still doesn't work, I will try commenting each dependency, thanks! – Vanessa Leung Jan 30 '19 at 09:37
  • looks like you are using older versions of firebase libraries, one of them might be using the older support library, try upgrading them first – karan Jan 30 '19 at 09:42
  • @KaranMer oh sorry I forgot to update firebase libraries, but I still get the warning after update, thanks! – Vanessa Leung Jan 30 '19 at 09:49

2 Answers2

2
implementation 'com.android.support:appcompat-v7:28.0.0-alpha3'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.android.support:design:28.1.0'

or try

 implementation 'com.android.support:appcompat-v7:28.0.0'
 implementation 'com.android.support:animated-vector-drawable:28.0.0'
 implementation 'com.android.support:exifinterface:28.0.0'
 implementation 'com.android.support:cardview-v7:28.0.0'
 implementation 'com.android.support:customtabs:28.0.0'
 implementation 'com.android.support:support-media-compat:28.0.0'
 implementation 'com.android.support:support-v4:28.0.0'
0

My suggestion for you is, try look into every latest version of every individual library for your project. Some of the library not even same version to each others. Lib A ver might be 2.0 and Lib B ver might be 2.5, but both is the latest (example such as Firebase). This dependency library version is part of the Android Studio 3.0.+ migration.

Infinite Loops
  • 671
  • 3
  • 11
  • 23