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

Android Studio Gradle同步错误:play-services-base依赖版本冲突

Fixing Play Services Base Dependency Conflict

Hey there, let’s work through this dependency conflict issue together! I know how frustrating it can be when you’ve updated all your Firebase/GMS dependencies but still hit version mismatch errors. Here’s a step-by-step breakdown to resolve this:

1. First, Identify the Conflict Source

The error message already suggests checking your dependency tree—this is the most important first step. Run this command in your project root:

./gradlew :app:dependencies

(Windows users use gradlew.bat :app:dependencies instead)

Once the command finishes, search the output for com.google.android.gms:play-services-base. You’ll see exactly which libraries are pulling in the conflicting versions (11.0.1, 15.0.1, and the 15.0.1-16.0.0 range). This helps you decide the best fix.

2. Force a Unified Version

The simplest way to resolve this is to tell Gradle to use a single, consistent version of play-services-base across all dependencies. Add this block to your app-level build.gradle file (inside the android block or at the top level):

configurations.all {
    resolutionStrategy {
        // Pick a version that’s compatible with your Firebase/GMS setup—16.0.0 fits the [15.0.1,16.0.0) range mentioned
        force 'com.google.android.gms:play-services-base:16.0.0'
    }
}

This overrides all conflicting version requests and ensures every library uses the version you specify. Just make sure the version you pick is compatible with your other Firebase/GMS dependencies (stick to the same major version as your Firebase SDKs for best results).

3. Ensure Firebase/GMS Version Consistency

Double-check that all your Firebase and GMS dependencies are using matching major versions. For example, if you’re using Firebase Auth 16.x, your play-services-auth (and other GMS libraries) should also be 16.x. Mixing major versions (like 15.x and 16.x) often causes these conflicts.

4. Exclude Conflicting Transitive Dependencies

If you found a specific third-party library that’s pulling in the old 11.0.1 version, you can exclude that transitive dependency directly. For example:

implementation('com.example.thirdparty:some-library:2.0.0') {
    exclude group: 'com.google.android.gms', module: 'play-services-base'
}

This tells Gradle not to include the old play-services-base from that library, letting your forced version take over.

5. Clean and Refresh Dependencies

Sometimes cached dependencies can cause lingering issues. Run these commands to clear the cache and rebuild your project:

./gradlew clean
./gradlew build --refresh-dependencies

After trying these steps, your conflict should be resolved. If you still run into issues, double-check the dependency tree again to make sure all instances of play-services-base are now using your forced version.

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.27 06:58:54