我有麻烦添加谷歌服务Gradle插件构建。Android Studio Chipmunk的gradle文件。具体来说,我正在尝试添加类路径'com.google.gms:google-services:4.3.12'.这似乎是项目级别的构建。Gradle文件与以前的版本不同。我不知道在哪里添加上述依赖。任何帮助将是非常感激的。谢谢。
将构建脚本类文件的代码粘贴到项目级gradle中。构建文件,下面是一个示例:
/**
* 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
}
从我的项目的例子。
项目级别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.gradle
:
plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
id 'kotlin-kapt'
id 'kotlin-android-extensions'
}