[英]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.