最新的Android Studio-添加Google Service Gradle插件的问题

发布于 2025-02-11 08:39:13 字数 233 浏览 2 评论 0原文

在最新Android Studio Chipmunk 中,我在build.gradle文件中添加Google Service gradle插件。具体来说,我正在尝试添加 classPath'com.google.gms:Google-Services:4.3.12'。 似乎项目级别构建。Gradle文件已从以前的版本更改。我不知道在哪里添加上述依赖关系。任何帮助将不胜感激。谢谢。

I am having trouble adding Google Service Gradle plugin to build.gradle file in latest Android Studio Chipmunk. Specifically I am trying to add classpath 'com.google.gms:google-services:4.3.12'.
It seems project level build.gradle file has changed from previous versions. I don't know where to add the above dependency. Any help would be highly appreciated. Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

白云不回头 2025-02-18 08:39:13

在项目级gradle.build文件中为您的build-script类文件粘贴代码,这是一个示例:

    /**
     * project-level - build.gradle file -- make sure buildscript is before 
     * plugins
    **/
    buildscript {
        repositories {
            mavenCentral()
        }
        dependencies {
// your classpath
            classpath 'com.google.dagger:hilt-android-gradle-plugin:2.41'
        }
    }
    
    // Top-level build file where you can add configuration options common to all sub-projects/modules.
    plugins {
        id 'com.android.application' version '7.1.3' apply false
        id 'com.android.library' version '7.1.3' apply false
        id 'org.jetbrains.kotlin.android' version '1.6.20' apply false
    }
    
    
    task clean(type: Delete) {
        delete rootProject.buildDir
    }

paste code for your build-script class file in project-level gradle.build file, here is an example :

    /**
     * project-level - build.gradle file -- make sure buildscript is before 
     * plugins
    **/
    buildscript {
        repositories {
            mavenCentral()
        }
        dependencies {
// your classpath
            classpath 'com.google.dagger:hilt-android-gradle-plugin:2.41'
        }
    }
    
    // Top-level build file where you can add configuration options common to all sub-projects/modules.
    plugins {
        id 'com.android.application' version '7.1.3' apply false
        id 'com.android.library' version '7.1.3' apply false
        id 'org.jetbrains.kotlin.android' version '1.6.20' apply false
    }
    
    
    task clean(type: Delete) {
        delete rootProject.buildDir
    }
长梦不多时 2025-02-18 08:39:13

我的项目的示例。

项目级build.gradle

// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
    id 'com.android.application' version '7.2.1' apply false
    id 'com.android.library' version '7.2.1' apply false
    id 'org.jetbrains.kotlin.android' version '1.7.0' apply false
    id 'org.jetbrains.kotlin.jvm' version '1.7.0' apply false
}

或模块级别build> build.gradle

plugins {
    id 'com.android.application'
    id 'org.jetbrains.kotlin.android'
    id 'kotlin-kapt'
    id 'kotlin-android-extensions'
}

Examples from my projects.

Project level build.gradle:

// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
    id 'com.android.application' version '7.2.1' apply false
    id 'com.android.library' version '7.2.1' apply false
    id 'org.jetbrains.kotlin.android' version '1.7.0' apply false
    id 'org.jetbrains.kotlin.jvm' version '1.7.0' apply false
}

Or module level build.gradle:

plugins {
    id 'com.android.application'
    id 'org.jetbrains.kotlin.android'
    id 'kotlin-kapt'
    id 'kotlin-android-extensions'
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文