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

标签 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
}
现在如何在这里添加类路径依赖项?

最佳答案

如果您将 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
}

关于java - 如何在 build.gradle 项目中添加类路径依赖项?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/71075781/

相关文章:

jenkins - 如何在Jenkins中运行的JMETER中包括CSV文件

java - API 声明必须是接口(interface) - Retrofit

矩形上的 JavaFx KeyEvent 不起作用

android - 隐藏/更改最近应用程序 Android 4.x 中的应用程序屏幕图片

android.view.InflateException(错误充气类)仅在生产

gradle - 在根项目中找不到任务 'run'

java - 用于多个 Web 应用程序的 Hazelcast 架构

java - 如何通过jdbc将日文字符添加到mysql数据库中?

android - 亚行错误: device not found while device is connected

android - connectedAndroidTest 和 release 构建类型