[英]Plugin with id 'com.google.gms.google-services' not found. [ Android ]
Firebase
Official link Firebase
官方链接
I'm Following This Link my 2nd step went through it correctly, but I think I am doing some mistakes in 3rd & the 4th There are some flaws in my code that I don't understand,我正在关注此链接,我的第二步正确完成了它,但我认为我在第三和第四步中犯了一些错误我的代码中存在一些我不理解的缺陷,
I will be glad if you can help us.如果你能帮助我们,我会很高兴。
build Gradle :- Project
构建 Gradle :-
Project
// 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
}
task clean(type: Delete) {
delete rootProject.buildDir
}
build Gradle : Module
构建 Gradle :
Module
plugins {
id 'com.android.application'
}
//code here..
apply plugin: 'com.google.gms.google-services'
android {
compileSdk 32
defaultConfig {
applicationId "com.company.myfire"
minSdk 21
targetSdk 32
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-
rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
classpath 'com.google.gms:google-services:4.3.10'
implementation 'androidx.appcompat:appcompat:1.4.1'
implementation 'com.google.android.material:material:1.6.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
implementation platform('com.google.firebase:firebase-bom:30.0.0')
implementation 'com.google.firebase:firebase-analytics'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}
The plugin needs to be referenced in the root build.gradle
:该插件需要在根目录
build.gradle
中被引用:
plugins {
id 'com.android.application' version '7.3.1' apply false
id 'com.android.library' version '7.3.1' apply false
id 'com.google.gms.google-services' version '4.3.14' apply false
}
Then it can be applied in a module build.gradle
:然后它可以应用于模块
build.gradle
:
plugins {
id 'com.android.application'
id 'com.google.gms.google-services'
}
You can give it a try:你可以试一试:
in build.gradle(Project: AppName)
在
build.gradle(Project: AppName)
buildscript {
dependencies {
classpath 'com.google.gms:google-services:4.3.10'
}
} // Top-level build file where you can add configuration options common
// to all sub-projects/modules.
plugins {
id 'com.android.application' version '7.2.0' apply false
id 'com.android.library' version '7.2.0' apply false
}
task clean(type: Delete) {
delete rootProject.buildDir
}
in build.gradle(Module: AppName)
:在
build.gradle(Module: AppName)
中:
plugins {
id 'com.android.application'
id 'com.google.gms.google-services'
}
android {
// rest code ....
}
dependencies {
// here your dependencies
}
and make sure you have added google-services.json
to your project.并确保您已将
google-services.json
添加到您的项目中。
and I will recommend you to connect firebase by android studio's firebase tool and avoid it manually.我会建议您使用 android 工作室的firebase 工具连接 firebase 并手动避免它。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.