2

I am getting error in build.gradle file

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).

Here is my gradle file

android {
            compileSdkVersion 28
            defaultConfig {
                applicationId "com.pristology.mysociety"
                minSdkVersion 15
                targetSdkVersion 28
                versionCode 3
                versionName "1.0.3"
                testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
            }
            buildTypes {
                release {
                    minifyEnabled false
                    proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
                }
            }
        }
            implementation fileTree(dir: 'libs', include: ['*.jar'])
            implementation 'com.android.support:appcompat-v7:28.0.0'

            implementation 'com.android.support:design:28.0.0'
            implementation 'com.android.support.constraint:constraint-layout:1.1.3'
            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:cardview-v7:28.0.0'

I am getting warning in app level gradle file when update android studio 3.3.2

MD Naseem Ashraf
  • 1,030
  • 2
  • 9
  • 22
jitendra namde
  • 183
  • 1
  • 1
  • 9

2 Answers2

2

All com.android.support libraries must use the exact same version specification

It happens because some of your libraries use an old version support-media-compat.

Just add explicitly the version of the library in your dependencies

implementation 'com.android.support:support-media-compat:28.0.0'
Gabriele Mariotti
  • 320,139
  • 94
  • 887
  • 841
-1

1st) you are getting problem because of different appcompat version so change your dependency because in gradle version 3.+ it causes problem

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

to this version

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

or you can use v7:27.1.1 but you have to change it everywhere in app:gradle

2nd) if you are using firebase then it will also cause problem so remove this line of code

implementation 'com.google.firebase:firebase-core:16.0.7'

because this line isn't necessary and u will get rid of this problem ;)

S Shikhar
  • 21
  • 4
  • 1
    Firebase isn't the problem. Downgrading support library is never advised; it breaks functionality/stability of app. Always use latest stable version of libraries. Never downgrade, there's valid reason why newer version to the library is made. New versions have bugfixes & added features. See the difference of version code: https://android.jlelse.eu/what-is-the-difference-between-canary-beta-rc-and-stable-releases-in-the-android-studio-bbbb77e7c3cf & https://medium.com/@maxirosson/versioning-android-apps-d6ec171cfd82 & https://developer.android.com/topic/libraries/support-library/revisions – MD Naseem Ashraf Mar 14 '19 at 06:46
  • if you use firebase then that line which i mention is also responsible for this problem if u used firebase ever then u must know and downgrade library causes problem but appcompat-v7:28.0.0 has bugs thats why i suggest appcompat-v7:28.0.0'-alpha1 and appcompat-v7:27.1.1 is for backup plan because it is fixed version and has no bugs – S Shikhar Mar 14 '19 at 07:27
  • Suggest an alpha (and previous!) release instead of stable release in general is never a good tip. – Gabriele Mariotti Mar 14 '19 at 08:54