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

Android Studio编译报错:Program type already present: com.google.android.gms.actions.SearchIntents

Fixing "Program type already present: com.google.android.gms.actions.SearchIntents" Error

Let’s work through this duplicate class error step by step. This issue pops up when the SearchIntents class gets included multiple times in your project’s dependencies—usually from conflicting versions of Google Play Services or Firebase libraries, or indirect imports from third-party tools.

Step 1: Fix the Incomplete Firebase Dependency

First, I notice your dependencies have a broken Firebase entry:

implementation 'com.google.firebase:fireb

This is a syntax error that’s likely causing unexpected behavior. Complete it with your full Firebase dependencies, like:

implementation 'com.google.firebase:firebase-core:16.0.0'
implementation 'com.google.firebase:firebase-database:16.0.1'
implementation 'com.google.firebase:firebase-auth:16.0.1'

Step 2: Align Google Play Services and Firebase Versions

A major source of this conflict is mismatched versions between Google Play Services and Firebase libraries. You’re using Play Services 15.0.1 alongside Firebase 16.x, which creates version clashes that lead to duplicate classes.

Update all your com.google.android.gms dependencies to versions compatible with your Firebase setup. For example, upgrade them to 16.0.0 (you can cross-check Google’s official docs for exact compatible versions):

implementation ('com.google.android.gms:play-services-maps:16.0.0') {
    exclude group: 'com.google.android.gms', module: 'actions'
}
implementation ('com.google.android.gms:play-services-auth:16.0.0') {
    exclude group: 'com.google.android.gms', module: 'actions'
}
implementation ('com.google.android.gms:play-services-location:16.0.0') {
    exclude group: 'com.google.android.gms', module: 'actions'
}

Step 3: Track Down Exact Duplicate Sources

Run the Gradle dependency tree command to pinpoint which libraries are pulling in the duplicate actions module:

  • On macOS/Linux:
    ./gradlew app:dependencies
    
  • On Windows:
    gradlew.bat app:dependencies
    

Search the output for com.google.android.gms:actions—this will show you every dependency that includes this module. Once you identify them, add exclude rules for each, or upgrade those dependencies to resolve the conflict.

Step 4: Do a Thorough Clean and Rebuild

Even though you’ve tried this before, dependency changes require a fresh build:

  1. Go to Build > Clean Project in Android Studio
  2. Then run Build > Rebuild Project
  3. Invalidate caches again (File > Invalidate Caches... > Check "Clear file system cache and local history" > Invalidate and Restart)

Step 5: Check Third-Party Library Conflicts

Libraries like the Facebook SDK might indirectly include Google Play Services modules. You’ve already excluded some support libraries, but add an exclude for the actions module to your Facebook dependencies if needed:

implementation ('com.facebook.android:facebook-login:4.33.0') {
    exclude group: 'com.android.support', module: 'support-v4'
    exclude group: 'com.android.support', module: 'appcompat-v7'
    exclude group: 'com.android.support', module: 'cardview-v7'
    exclude group: 'com.android.support', module: 'customtabs'
    exclude group: 'com.google.android.gms', module: 'actions' // Add this if the dependency tree shows it's needed
}

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.29 06:40:52