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

Gradle构建报错:找不到com.google.gms.google-services 4.4.0插件

Gradle构建时Google Services Plugin找不到的问题求助

错误信息

Plugin [id: 'com.google.gms.google-services', version: '4.4.0', apply: false] was not found in any of the following sources:

已尝试的操作

  • 按照Firebase官方说明配置了项目的Gradle文件,相关代码如下:
    build.gradle (Project: example)

    // Top-level build file where you can add configuration options common to all sub-projects/modules.
    plugins {
        id 'com.android.application' version '8.1.0' apply false
        id 'org.jetbrains.kotlin.android' version '1.8.10' apply false
        id 'com.google.gms.google-services' version '4.4.0' apply false
    }
    

    build.gradle (Module :app)

    plugins {
        id 'com.android.application'
        id 'org.jetbrains.kotlin.android'
        id 'com.google.gms.google-services'
    }
    
    android {
        namespace 'com.example.example'
        compileSdk 33
    
        defaultConfig {
            applicationId "com.example.example"
            minSdk 28
            targetSdk 33
            versionCode 1
            versionName "1.0"
    
            testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
            vectorDrawables {
                useSupportLibrary true
            }
        }
    
        buildTypes {
            release {
                minifyEnabled false
                proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
            }
        }
        compileOptions {
            sourceCompatibility JavaVersion.VERSION_1_8
            targetCompatibility JavaVersion.VERSION_1_8
        }
        kotlinOptions {
            jvmTarget = '1.8'
        }
        buildFeatures {
            compose true
        }
        composeOptions {
            kotlinCompilerExtensionVersion '1.4.3'
        }
        packaging {
            resources {
                excludes += '/META-INF/{AL2.0,LGPL2.1}'
            }
        }
    }
    
    dependencies {
    
        implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.6.1'
        implementation 'androidx.activity:activity-compose:1.7.2'
        implementation platform('androidx.compose:compose-bom:2023.03.00')
        implementation 'androidx.compose.ui:ui'
        implementation 'androidx.compose.ui:ui-graphics'
        implementation 'androidx.compose.ui:ui-tooling-preview'
        implementation 'androidx.compose.material3:material3'
    
        implementation 'androidx.core:core-ktx:1.10.1'
        implementation 'androidx.appcompat:appcompat:1.6.1'
        implementation 'com.google.android.material:material:1.9.0'
    
        androidTestImplementation platform('androidx.compose:compose-bom:2023.03.00')
        androidTestImplementation 'androidx.compose.ui:ui-test-junit4'
        debugImplementation 'androidx.compose.ui:ui-tooling'
        debugImplementation 'androidx.compose.ui:ui-test-manifest'
    
        implementation 'com.google.mlkit:text-recognition:16.0.0'
        implementation 'com.google.mlkit:text-recognition-chinese:16.0.0'
        implementation 'com.google.mlkit:text-recognition-devanagari:16.0.0'
        implementation 'com.google.mlkit:text-recognition-japanese:16.0.0'
        implementation 'com.google.mlkit:text-recognition-korean:16.0.0'
    
        implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.4'
        implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4'
    
        implementation 'androidx.palette:palette:1.0.0'
    
        implementation 'com.google.mlkit:translate:17.0.1'
    
        testImplementation 'junit:junit:4.13.2'
        androidTestImplementation 'androidx.test.ext:junit:1.1.5'
        androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
    
        implementation project(':opencv')
    
        implementation platform('com.google.firebase:firebase-bom:32.5.0')
        implementation 'com.google.firebase:firebase-analytics'
    
    }
    

    settings.gradle (Project Settings)

    pluginManagement {
        repositories {
            google()
            mavenCentral()
            gradlePluginPortal()
        }
    }
    
    dependencyResolutionManagement {
        repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
        repositories {
            google()
            mavenCentral()
        }
    }
    
    rootProject.name = "example"
    include ':app'
    include ':opencv'
    
  • 尝试过Stack Overflow上的同类问题解决方案,但均未解决问题。

求助

求可行的解决思路或额外修复步骤。


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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.06 13:43:25