如何在build.gradle项目中添加类路径依赖项?

Abh*_*i S 8 java android gradle

Gradle 更新后,每个新项目在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.1.0' apply false
    id 'com.android.library' version '7.1.0' apply false
}

task clean(type: Delete) {
    delete rootProject.buildDir
}
Run Code Online (Sandbox Code Playgroud)

现在如何在此处添加类路径依赖项?

小智 10

如果您要将 firebase 添加到您的 Android 应用程序中,它需要如下所示。


buildscript {
    repositories {
        // Check that you have the following line (if not, add it):
        google()  // Google's Maven repository

    }
    dependencies {

        // Add this line
        classpath 'com.google.gms:google-services:4.3.10'

    }
}



plugins {
    id 'com.android.application' version '7.1.2' apply false
    id 'com.android.library' version '7.1.2' apply false
}


task clean(type: Delete) {
    delete rootProject.buildDir
}
Run Code Online (Sandbox Code Playgroud)