Resolving “All libraries must use the exact same version specification” Error in Android Studio

Resolving "All libraries must use the exact same version specification" Error in Android Studio

22 May 2024 Stephan Petzl Leave a comment Tech-Help

After updating to Android Studio 2.3 or later, you might encounter the following error message:

All libraries must use the exact same version specification (mixing versions can lead to runtime crashes). Found versions 25.1.1, 24.0.0. Examples include and

This error occurs when different versions of the Android support libraries are used within the same project, which can lead to runtime crashes. Below, we outline a step-by-step guide to resolve this issue effectively.

Step-by-Step Solution

1. Identify Conflicting Versions

The first step is to identify which libraries are causing the conflict. You can do this by running a Gradle dependency report. Open your terminal and navigate to your project directory, then run:

./gradlew -q dependencies app:dependencies --configuration debugAndroidTestCompileClasspath

For Windows Command Prompt, use:

gradlew -q dependencies app:dependencies --configuration debugAndroidTestCompileClasspath

This command will generate a report showing all dependencies and their versions. Look for any discrepancies in the versions of the Android support libraries.

2. Update Dependencies

Once you’ve identified the conflicting versions, update your build.gradle file to ensure all support libraries use the same version. For example, if you find that is using an older version, update it to match the version used by other support libraries:

implementation ""

Ensure you update all instances of the support libraries to the same version. Here is an example of a corrected build.gradle file:

dependencies {
    implementation ''
    implementation ''
    implementation ''
    implementation ''
    implementation ''
    implementation ''

After making these changes, sync your project by clicking on “Sync Now” in the top-right corner of Android Studio.

3. Use Gradle’s Resolution Strategy

If you are still facing issues, you can use Gradle’s resolution strategy to force all dependencies to use the same version:

configurations.all {
    resolutionStrategy.eachDependency { DependencyResolveDetails details ->
        def requested = details.requested
        if ( == '') {
            details.useVersion '27.0.2'

Place this block at the end of your build.gradle file (Module: app), replacing 27.0.2 with the version you are using.


By following these steps, you can resolve the version conflict in your Android support libraries and prevent runtime crashes. Keeping your dependencies consistent is crucial for the stability of your application.

Enhance Your Testing with Repeato

While resolving dependency issues is critical, ensuring the overall quality of your application is equally important. This is where Repeato comes in. Repeato is a no-code test automation tool for iOS and Android that helps you create, run, and maintain automated tests for your apps efficiently.

Repeato leverages computer vision and AI, making it particularly fast to edit and run tests. This allows developers to focus on creating a great product instead of spending time on creating and maintaining tests. Moreover, Repeato enables non-technical colleagues or QAs to handle test automation tasks, thereby improving team productivity.

For more information on setting up and using Repeato, visit our documentation page.

Like this article? there’s more where that came from!