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

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"
}
Android Android Commands Android Java Applications Application Libraries Application Stack / User Interface Bash / Shell Scripts Commands and Packages Compilation Content Management System - CMS Core Kernel C Programs Development & Build Development Environment Setup Errors & Failures Flutter git Go Language Programs Hardware Platforms HTML JAVA Programs Kernel & Device Drivers Linux, OS Concepts and Networking Linux Device Drivers Linux Host, Ubuntu, SysAdmin Linux Kernel Linux Networking Middleware Libraries, HAL Monetization / Google AdSense Multimedia - Audio, Video, Images NDK / Middleware / HAL OS Concepts PHP Programming Languages RaspberryPi Scripting and Automation Search Engine Optimisation ( SEO ) Social Media Socurce Code Management ( SCM ) System Administration, Security Testing and Debugging Uncategorized User Interface Web design and development Wordpress Yocto / Bitbake / Openembedded

Leave a Reply / Ask Question