If you are trying to compile an android Application which is developed by someone or you downloaded from github, there are chances if you compile from command line using “./gradlew clean build” you may see an error like as below,
Error: 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:mediarouter-v7:26.1.0 [GradleCompatible]
The problem with this is that there has been some version mismatch has happened between the libraries you used, its possible that the you may have used the same version everywhere in build.gradle but the libraries you have included, might have been using different versions internally.
Solution :
As we can see from error logs, mediarouter library version is v7-26.1.0 and vector-drawable version is 28.0.0, so if we opened app/build.gradle, our source code was using 28.0.0 for all libraries, so possible some dependent library was using mediarouter v7:26.1.0,
To resolve this, add proper “implementation” line for the respective library and version in app/build.gradle, so we added
dependencies {
implementation "com.android.support:mediarouter-v7:28.0.0"
}
Go to project/.idea/libraries folder on your file system and see which libraries are different.
You will have to manually include these libraries with the same version in your build.gradle file.
Then, sync your project.
E.g.:
Ex [Here](https://icetutor.com/question/all-com-android-support-libraries-must-use-the-exact-same-version-specification/)