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

Gradle版本冲突问题求助:processDebugGoogleServices任务执行失败

Fixing the ':app:processDebugGoogleServices' Version Conflict Error

Hey, let's resolve this version conflict issue you're hitting with the :app:processDebugGoogleServices task. The core problem here is that all com.google.android.gms and com.google.firebase dependencies in your project must use the same version—right now you have play-services-ads:11.8.0 paired with Firebase dependencies on 9.8.0, which breaks the Google Services plugin's requirements.

Below are two solutions you can choose from:

Solution 1: Keep Your Current FirebaseUI Version, Unify All Dependencies to 9.8.0

If you want to stick with your existing FirebaseUI 0.4.3 (which is compatible with Firebase/Play Services 9.8.0), just adjust the mismatched play-services-ads version and update deprecated dependency declarations:

Modified app-level build.gradle:

apply plugin: 'com.android.application'
android {
    compileSdkVersion 25
    defaultConfig {
        applicationId "com.example.learn"
        minSdkVersion 17
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}
dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:25.0.0'
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.1'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
    implementation 'com.google.firebase:firebase-database:9.8.0'
    implementation 'com.firebase:firebase-client-android:2.3.1'
    implementation 'com.firebaseui:firebase-ui:0.4.3'
    implementation 'com.android.support:design:25.0.0'
    implementation 'com.google.firebase:firebase-auth:9.8.0'
    // Updated to match the 9.8.0 version of other Firebase/GMS dependencies
    implementation 'com.google.android.gms:play-services-ads:9.8.0'
}
apply plugin: 'com.google.gms.google-services'

Make sure your project-level build.gradle uses a compatible Google Services plugin:

buildscript {
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.3.3' // Matches compileSdk 25
        classpath 'com.google.gms:google-services:3.1.0' // Compatible with 9.8.0 dependencies
    }
}

allprojects {
    repositories {
        google()
        jcenter()
    }
}

Old versions of Firebase and Play Services have known security vulnerabilities, so upgrading to a more recent stable set of versions is a better long-term choice. We'll use Firebase/Play Services 11.8.0, which pairs with FirebaseUI 1.2.0:

Modified app-level build.gradle:

apply plugin: 'com.android.application'
android {
    compileSdkVersion 26 // Updated to support 11.8.0 dependencies
    defaultConfig {
        applicationId "com.example.learn"
        minSdkVersion 17
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}
dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    // Updated support libraries to match compileSdk 26
    implementation 'com.android.support:appcompat-v7:26.1.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
    // Unified all Firebase dependencies to 11.8.0
    implementation 'com.google.firebase:firebase-database:11.8.0'
    implementation 'com.firebase:firebase-client-android:2.3.1'
    // Upgraded FirebaseUI to 1.2.0 (compatible with 11.8.0)
    implementation 'com.firebaseui:firebase-ui:1.2.0'
    implementation 'com.android.support:design:26.1.0'
    implementation 'com.google.firebase:firebase-auth:11.8.0'
    implementation 'com.google.android.gms:play-services-ads:11.8.0'
}
apply plugin: 'com.google.gms.google-services'

Modified project-level build.gradle:

buildscript {
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.1' // Matches compileSdk 26
        classpath 'com.google.gms:google-services:3.2.1' // Compatible with 11.8.0 dependencies
    }
}

allprojects {
    repositories {
        google()
        jcenter()
    }
}

After making either set of changes, click the Sync Project with Gradle Files button in Android Studio's toolbar. This should resolve the version conflict and let your build complete successfully.

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.15 03:45:15