我要在我的 android 项目中的什么地方添加 com.google.gms:google-services 插件?
Where do i add the com.google.gms:google-services plugin in my android project?
我刚刚了解如何将 firebase 添加到您的 kotlin 项目并看到了这篇文档 HERE(firebase 文档)。
文档中的文件如下所示:
buildscript {
repositories {
// Check that you have the following line (if not, add it):
google() // Google's Maven repository
}
dependencies {
// ...
// Add the following line:
classpath 'com.google.gms:google-services:4.3.10' // Google Services plugin
}
}
allprojects {
// ...
repositories {
// Check that you have the following line (if not, add it):
google() // Google's Maven repository
// ...
}
}
基本上需要在dependencies
里面添加下面一行:-
classpath 'com.google.gms:google-services:4.3.10' // Google Services plugin
问题是我的 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.2' apply false
id 'com.android.library' version '7.1.2' apply false
id 'org.jetbrains.kotlin.android' version '1.5.30' apply false
}
task clean(type: Delete) {
delete rootProject.buildDir
}
那么我应该在哪里以及如何将这个文件添加到我的 android 项目中?
这是一种新格式,您可以像这样添加到您的插件中
id 'com.google.gms.google-services' version '4.3.10' apply false
我刚刚了解如何将 firebase 添加到您的 kotlin 项目并看到了这篇文档 HERE(firebase 文档)。
文档中的文件如下所示:
buildscript {
repositories {
// Check that you have the following line (if not, add it):
google() // Google's Maven repository
}
dependencies {
// ...
// Add the following line:
classpath 'com.google.gms:google-services:4.3.10' // Google Services plugin
}
}
allprojects {
// ...
repositories {
// Check that you have the following line (if not, add it):
google() // Google's Maven repository
// ...
}
}
基本上需要在dependencies
里面添加下面一行:-
classpath 'com.google.gms:google-services:4.3.10' // Google Services plugin
问题是我的 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.2' apply false
id 'com.android.library' version '7.1.2' apply false
id 'org.jetbrains.kotlin.android' version '1.5.30' apply false
}
task clean(type: Delete) {
delete rootProject.buildDir
}
那么我应该在哪里以及如何将这个文件添加到我的 android 项目中?
这是一种新格式,您可以像这样添加到您的插件中
id 'com.google.gms.google-services' version '4.3.10' apply false