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

遇到Program type already present: com.google.android.gms.internal.zzfq报错求解决

Fixing "Program type already present: com.google.android.gms.internal.zzfq" Error

Hey there, I’ve run into this exact duplicate class error before—let’s get it sorted out for you. The root cause here is almost always conflicting versions of Google Play Services (GMS) libraries in your project, where multiple dependencies pull in different versions of the same GMS modules, leading to duplicate class files like com.google.android.gms.internal.zzfq.

Since you’ve already tried the basic fixes (clean/rebuild, deleting .build/.idea, adjusting compile versions), let’s dive into the targeted solutions:

1. Identify Duplicate GMS Dependencies

First, run this command in your project root to generate a full dependency tree—it’ll show you exactly which libraries are pulling in conflicting GMS versions:

./gradlew app:dependencies

Look for entries under com.google.android.gms—you’ll likely see multiple versions of the same module (e.g., play-services-base with 15.0.0 and 16.0.1).

2. Force a Unified GMS Version

Add a resolution strategy to your project-level build.gradle to force all GMS dependencies to use the same compatible version. Since your compileSdkVersion is 27, stick to GMS version 15.x (this aligns with Android API 27):

allprojects {
    repositories {
        // Keep your existing repo config here (google(), jcenter(), etc.)
    }
    configurations.all {
        resolutionStrategy {
            // Force all GMS modules to use the same version
            force 'com.google.android.gms:play-services-base:15.0.1'
            force 'com.google.android.gms:play-services-analytics:15.0.1'
            // Add any other GMS modules your project uses (e.g., maps, auth) here
        }
    }
}

This ensures no third-party dependency (like Fabric/Crashlytics) pulls in a mismatched GMS version that clashes with your project’s setup.

3. Clean Up Redundant Dependencies

  • Avoid using the catch-all play-services-all library—it pulls in every GMS module, increasing the chance of duplicates. Instead, only include the specific GMS modules your app actually needs (e.g., play-services-maps, play-services-auth).
  • Double-check your app-level build.gradle for duplicate GMS entries—make sure you’re not declaring the same module twice with different versions.

4. Verify Fabric Compatibility

Since you’re using the io.fabric plugin, ensure your Crashlytics/Fabric dependencies are compatible with your unified GMS version. You can explicitly declare the Fabric version in your app-level build.gradle to avoid conflicts:

dependencies {
    // Example Fabric/Crashlytics setup with explicit versions
    implementation 'com.crashlytics.sdk.android:crashlytics:2.9.9'
    implementation 'com.google.firebase:firebase-core:15.0.1' // Match your GMS version
}

After applying these changes, run a full clean and rebuild again (./gradlew clean assembleDebug)—this should resolve the duplicate class error.

内容的提问来源于stack exchange,提问作者Vaibhav Kumar Gautam

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.21 08:00:45