2

As I am using latest version of Android Studio and getting warning / error in build.gradle file

All com.android.support libraries must use same exact version . Found version 28.0.0 and 26.1.0 . animated-vector-drawable:28.0.0 and support-media-compat:26.1.0

Tried all answers an Options that already are on Stack Overflow but nothing worked .

Can Somebody help , What is the Problem .

Here is Android Studio SS enter image description here

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
Rashid Kalhoro
  • 340
  • 4
  • 14

2 Answers2

1

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). So, if you want to remove this warning because it will not give compile time error then write the given line above this error line:-

//noinspection GradleCompatible

If you don't want to face any problem in future then i suggest to use those tools and libraries which have same version as support libraries

DeePanShu
  • 1,236
  • 10
  • 23
1

There are 2 ways to fix it

1) Hover your mouse on top of the error for some time and it will show you what libraries have mixed versions , just add those libraries in your project .

In your case add

implementation 'com.android.support:support-media-compat:28.0.0'

It may show other libraries after adding this . Add those libaries too . All support library packages can be found over here

2) Add this at the end of app level build.gradle

configurations.all {
resolutionStrategy.eachDependency { details ->
    def requested = details.requested
    if (requested.group == 'com.android.support') {
        if (!requested.name.startsWith("multidex")) {
            details.useVersion "28.0.0"
        }
    }
  }
}

Credit to Eugen Pechanec

Manohar
  • 22,116
  • 9
  • 108
  • 144