[英]how can I add google services classpath for firebase in build.gradle of new android studio
My project's build.gradle code =我项目的 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
}
I am trying to add classpath 'com.google.gms:google-services:4.3.13'
in my project's build.gradle file but am not getting any space to paste.我正在尝试在我的项目的 build.gradle 文件中添加
classpath 'com.google.gms:google-services:4.3.13'
但没有任何空间可以粘贴。 Even I have tried putting this before and after plugins =即使我尝试在插件之前和之后放置它=
dependencies {
classpath 'com.google.gms:google-services:4.3.13'
}
Still I am having problem.我仍然有问题。 I also have tried to insert plugins inside dependencies but problem still occurs.
我也尝试在依赖项中插入插件,但问题仍然存在。
Now, I need a solution.现在,我需要一个解决方案。
I am answering my problem just because to help out people who couldn't solve it.我回答我的问题只是为了帮助那些无法解决它的人。
The main thing here is, we have to add the dependencies before the "// Top level build....".这里的主要内容是,我们必须在“// Top level build....”之前添加依赖项。
I solved it sometimes before with a help.我有时在帮助下解决了它。
The code should be:代码应该是:
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
}
This is the main solve.这是主要的解决方法。 You can add more classpaths if you want.
如果需要,您可以添加更多类路径。
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 }
happy code!!!快乐的代码!!!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.