You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Android Studio Gradle support库版本冲突警告修复求助

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

Hey there, let's tackle this Gradle warning once and for all! The issue here is actually coming from your Google Play Services dependencies, not the support libraries you've already tried adding. Let me break down what's going on:

What's Causing the Warning?

Your build includes com.google.android.gms:play-services:10.2.0—this is a huge "catch-all" library that pulls in dozens of Play Services modules, including mediarouter-v7:24.0.0 (which is the old version conflicting with your 28.0.0 support libraries). On top of that, you're also including play-services-maps:10.2.0 separately, which is redundant since the full play-services library already includes it.

Step-by-Step Fix

  1. Remove the redundant full Play Services dependency
    Delete this line entirely from your dependencies block:

    implementation 'com.google.android.gms:play-services:10.2.0'
    
  2. Upgrade your Play Services Maps dependency to a version compatible with your support libraries
    Your Firebase dependencies are on version 16.x, so you need a matching Play Services version. Replace your old maps dependency with:

    implementation 'com.google.android.gms:play-services-maps:16.0.0'
    

    This version won't pull in the old 24.0.0 support library.

  3. Verify the fix (optional but helpful)
    If you want to double-check which dependencies are pulling in old support libraries, run this command in Android Studio's Terminal:

    • For Mac/Linux: ./gradlew app:dependencies
    • For Windows: gradlew app:dependencies
      Search the output for mediarouter-v7—you should no longer see the 24.0.0 version listed.

Updated build.gradle(app) Dependencies Block

Here's what your dependencies should look like after the changes:

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    //Add Library
    implementation 'com.jaredrummler:material-spinner:1.1.0'
    //Firebase
    implementation 'com.google.firebase:firebase-storage:16.0.5'
    implementation 'com.google.firebase:firebase-auth:16.1.0'
    implementation 'com.firebaseui:firebase-ui-database:4.3.1'
    implementation 'com.google.firebase:firebase-database:16.0.6'
    implementation 'com.google.firebase:firebase-core:16.0.6'
    //Support Libraries
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support:support-v4:28.0.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    implementation 'com.android.support:design:28.0.0'
    implementation 'com.android.support:cardview-v7:28.0.0'
    implementation 'com.android.support:recyclerview-v7:28.0.0'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
    implementation 'com.squareup.picasso:picasso:2.5.2'
    implementation 'com.rengwuxian.materialedittext:library:2.1.4'
    //Updated Play Services Maps dependency
    implementation 'com.google.android.gms:play-services-maps:16.0.0'
    //ForLocation
    testImplementation 'junit:junit:4.12'
}

Why This Works

By removing the full play-services library, you eliminate the old mediarouter-v7:24.0.0 dependency that was causing the version conflict. Upgrading play-services-maps to a 16.x version ensures it uses support libraries compatible with your 28.0.0 setup. Your app should now build without the version mismatch warning, while still running as expected.

内容的提问来源于stack exchange,提问作者Vanessa Leung

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.11 09:26:20