[英]how can I add google services classpath for firebase in build.gradle of new android studio
我项目的 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
}
task clean(type: Delete) {
delete rootProject.buildDir
}
我正在尝试在我的项目的 build.gradle 文件中添加classpath 'com.google.gms:google-services:4.3.13'
但没有任何空间可以粘贴。 即使我尝试在插件之前和之后放置它=
dependencies {
classpath 'com.google.gms:google-services:4.3.13'
}
我仍然有问题。 我也尝试在依赖项中插入插件,但问题仍然存在。
现在,我需要一个解决方案。
我回答我的问题只是为了帮助那些无法解决它的人。
这里的主要内容是,我们必须在“// Top level build....”之前添加依赖项。
我有时在帮助下解决了它。
代码应该是:
dependencies {
classpath 'com.google.gms:google-services:4.3.13'
}
// 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
}
task clean(type: Delete) {
delete rootProject.buildDir
}
这是主要的解决方法。 如果需要,您可以添加更多类路径。
buildscript { dependencies { classpath 'com.google.gms:google-services:4.3.13' } } // 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 } task clean(type: Delete) { delete rootProject.buildDir }
快乐的代码!!!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.