[英]Plugin with id 'com.google.gms.google-services' not found
I have followed this link to integrate ads in my app.我已点击此链接将广告集成到我的应用程序中。 But it shows this error:
但它显示此错误:
This is my build.gradle:这是我的 build.gradle:
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 24
buildToolsVersion "24.0.2"
defaultConfig {
applicationId "com.example.personal.numbermania"
minSdkVersion 10
targetSdkVersion 24
versionCode 1
versionName "1.0"
}
buildTypes {
debug
{
debuggable true
}
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:24.2.1'
compile 'com.android.support:design:24.2.1'
compile 'com.google.firebase:firebase-ads:9.6.0'
}
}
ads are not showing up in real device.please help me This is my error after i updated classpath error广告没有出现在真实设备中。请帮助我这是我更新类路径错误后的错误
Had the same problem.有同样的问题。
Fixed by adding the dependency通过添加依赖项修复
classpath 'com.google.gms:google-services:3.0.0'
to the root build.gradle
.到根
build.gradle
。
https://firebase.google.com/docs/android/setup#manually_add_firebase https://firebase.google.com/docs/android/setup#manually_add_firebase
Add classpath com.google.gms:google-services:3.0.0
dependencies at project level build.gradle在项目级别 build.gradle 添加
classpath com.google.gms:google-services:3.0.0
依赖项
Refer the sample block from project level build.gradle参考项目级 build.gradle 中的示例块
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
classpath 'com.google.gms:google-services:3.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
You can find the correct dependencies here apply changes to app.gradle and project.gradle and tell me about this, greetings!您可以在此处找到正确的依赖项,将更改应用到app.gradle和project.gradle并告诉我这一点,问候!
Your apply plugin: 'com.google.gms.google-services' in app.gradle looks like this:您的应用插件: app.gradle中的“com.google.gms.google-services”如下所示:
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion "24.0.2"
defaultConfig {
applicationId "com.example.personal.numbermania"
minSdkVersion 10
targetSdkVersion 24
versionCode 1
versionName "1.0"
multiDexEnabled true
}
dexOptions {
incremental true
javaMaxHeapSize "4g" //Here stablished how many cores you want to use your android studi 4g = 4 cores
}
buildTypes {
debug
{
debuggable true
}
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:24.2.1'
compile 'com.android.support:design:24.2.1'
compile 'com.google.firebase:firebase-ads:9.6.1'
compile 'com.google.firebase:firebase-core:9.6.1'
compile 'com.google.android.gms:play-services:9.6.1'
}
apply plugin: 'com.google.gms.google-services'
Add classpath to the project's gradle :将类路径添加到项目的 gradle :
classpath 'com.google.gms:google-services:3.0.0'
Google play services library on SDK Manager: SDK Manager 上的 Google Play 服务库:
Setting up Gradle plugins
in the root build.gradle
meanwhile works alike this:同时在根
build.gradle
中设置 Gradle plugins
的工作方式如下:
plugins {
id "com.android.application" version "7.2.1" apply false
id "com.android.library" version "7.2.1" apply false
id "com.google.gms.google-services" version "4.3.13" apply false
}
Then they can be applied in a module:然后它们可以应用在一个模块中:
plugins {
id "com.android.application"
id "com.google.gms.google-services"
}
Unless some Gradle plugin may depend on it, one can remove/skip the buildscript
block altogether, but it's still good for defining project-wide version numbers in buildscript.ext
:除非某些 Gradle 插件可能依赖它,否则可以完全删除/跳过
buildscript
块,但它仍然适用于在buildscript.ext
中定义项目范围的版本号:
buildscript {
ext {
agp_version = '7.2.1'
gms_version = '4.3.13'
}
}
plugins {
id 'com.android.application' version "$agp_version" apply false
id 'com.android.library' version "$agp_version" apply false
id "com.google.gms.google-services" version "$gms_version" apply false
}
Had the same problem.有同样的问题。
adding this to my dependency didn't solve将此添加到我的依赖项中并没有解决
classpath 'com.google.gms:google-services:3.0.0'
类路径 'com.google.gms:google-services:3.0.0'
Adding this solved for me添加这个为我解决了
classpath 'com.google.gms:google-services:+'
类路径 'com.google.gms:google-services:+'
to the root build.gradle.到根 build.gradle。
simply add "classpath 'com.google.gms:google-services:3.0.0'" to android/build.gradle to look like this只需将 "classpath 'com.google.gms:google-services:3.0.0'" 添加到 android/build.gradle 即可看起来像这样
buildscript {
repositories {
maven {
url "https://maven.google.com"
}
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
classpath 'com.google.gms:google-services:3.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
and also add "apply plugin: 'com.google.gms.google-services'" to the end of file in android/app/build.gradle to look like this并将“应用插件:'com.google.gms.google-services'”添加到 android/app/build.gradle 的文件末尾,看起来像这样
apply plugin: 'com.google.gms.google-services'
On upgrading to Android Studio 4.2.1, I was prompted to set dependency:在升级到 Android Studio 4.2.1 时,系统提示我设置依赖项:
classpath 'com.google.gms:google-services:4.3.7'
However, this caused "Plugin with id 'com.google.gms.google-services' not found".但是,这导致“找不到 ID 为 'com.google.gms.google-services' 的插件”。
Leaving it as follows fixed the problem:将其保留如下解决了问题:
classpath 'com.google.gms:google-services:4.3.5'
EDIT:编辑:
This problem has now been fixed in:此问题现已在以下位置修复:
classpath 'com.google.gms:google-services:4.3.8'
In build.gradle(Module:app) add this code在 build.gradle(Module:app) 添加此代码
dependencies {
……..
compile 'com.google.android.gms:play-services:10.0.1’
……
}
If you still have a problem after that, then add this code in build.gradle(Module:app)如果之后仍然有问题,那么在 build.gradle(Module:app) 中添加这段代码
defaultConfig {
….
…...
multiDexEnabled true
}
dependencies {
…..
compile 'com.google.android.gms:play-services:10.0.1'
compile 'com.android.support:multidex:1.0.1'
}
I changed google-services classpath version from 4.2.0 to 3.0.0我将 google-services 类路径版本从 4.2.0 更改为 3.0.0
classpath 'com.google.gms:google-services:3.0.0'
Then rebuild the project, Then strangely it suggested me to add firebase core to the project.然后重建项目,然后奇怪的是它建议我将firebase核心添加到项目中。
Then I added firebase core on the app(module)然后我在应用程序(模块)上添加了firebase核心
implementation 'com.google.firebase:firebase-messaging:16.0.8'
Then the error disappeared magically.然后错误神奇地消失了。
I'm not sure about you, but I spent about 30 minutes troubleshooting the same issue here, until I realized that the line for app/build.gradle is:我不确定你的情况,但我在这里花了大约 30 分钟来解决同样的问题,直到我意识到 app/build.gradle 的行是:
apply plugin: 'com.google.gms.google-services'
and not:并不是:
apply plugin: 'com.google.gms:google-services'
Eg: I had copied that line from a tutorial, but when specifying the apply plugin namespace, no colon ( :
) is required.例如:我从教程中复制了该行,但是在指定应用插件命名空间时,不需要冒号 (
:
)。 It's, in fact, a dot.事实上,它是一个点。 (
.
). (
.
)。
Hey... it's easy to miss.嘿...很容易错过。
In the app build.gradle
dependency, you must add the following code在app
build.gradle
依赖中,必须添加如下代码
classpath 'com.google.gms:google-services:$last_version'
And then please check the Google Play Service SDK tools installing status.然后请检查 Google Play Service SDK 工具安装状态。
Ended up on this thread while trying to integrate Firebase with a Flutter application.在尝试将 Firebase 与 Flutter 应用程序集成时结束了这个线程。 So, in case you are facing the same problem in Flutter, below steps solved the issue for me.
所以,如果你在 Flutter 中遇到同样的问题,下面的步骤为我解决了这个问题。
Disclaimer : first steps are the same as described in the documentation and every answer/tutorial found online.
免责声明:第一步与文档和在线找到的每个答案/教程中描述的相同。 I am just mentioning them on a high level for the sake of keeping my answer consistent .
为了保持我的回答一致,我只是在高层次上提到它们。
The actual step that is different and solved the issue is the last one .
不同并解决问题的实际步骤是最后一步。
repositories { google() jcenter() maven { url "https://maven.google.com" } } dependencies { classpath 'com.android.tools.build:gradle:3.5.0' classpath 'com.google.gms:google-services:4.3.4' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" } allprojects { repositories { google() jcenter() maven { url "https://maven.google.com" } } }
apply plugin: 'com.android.application' apply plugin: 'kotlin-android' apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" apply plugin: 'com.google.gms.google-services'
dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" implementation platform('com.google.firebase:firebase-bom:26.3.0') implementation 'com.google.firebase:firebase-analytics' implementation 'com.google.firebase:firebase-messaging' testImplementation 'junit:junit:4.+' androidTestImplementation 'androidx.test.ext:junit:1.1.2' androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0' }
You can find a working demo for this here https://gitlab.com/ecocupaegean/ecocupaegean/-/tree/master/ , in order to run the app you just need to add your own google-services.json, and specify an API KEY for google maps geolocation API.你可以在这里找到一个工作演示https://gitlab.com/ecocupaegean/ecocupaegean/-/tree/master/ ,为了运行你只需要添加你自己的 google-services.json 的应用程序,并指定一个谷歌地图地理定位 API 的 API KEY。
apply plugin: 'com.google.gms.google-services'
在您的应用程序 gradle.build 的底部添加上述行。
Non of the answers above helped in my case, but following this tutorial thoroughly did.在我的情况下,上面的答案都没有帮助,但是完全按照本教程做了。 Maps SDK for Android / Set up an Android Studio project
适用于 Android 的 Maps SDK / 设置 Android Studio 项目
在项目的 build.gradle 添加以下内容
classpath 'com.google.gms:google-services:4.3.3'
我是一个删除/重新安装的人,所以我断开了与 Firebase 的连接并从控制台重新安装了 Firebase。
The Google docs during the Android setup process didn't quite work for me. Android 设置过程中的 Google 文档对我来说不太适用。 It seems like Google need to update their docs.
谷歌似乎需要更新他们的文档。 The only solution that worked for me was:
唯一对我有用的解决方案是:
build.gradle
file.build.gradle
文件中。dependencies {
classpath 'com.google.gms:google-services:4.3.14'
// ...
}
This plugin will allow to process the google-services.json
file and produce Android resources that can be used in your application's code.此插件将允许处理
google-services.json
文件并生成可在您的应用程序代码中使用的 Android 资源。 Also, it will allow to install dependencies for Firebase related libraries, which is going to be the next step.此外,它将允许为 Firebase 相关库安装依赖项,这将是下一步。
build.gradle
file:build.gradle
文件中:apply plugin: 'com.google.gms.google-services'
Sources:资料来源:
re_check firebase 安装指南,您错过了一些更改
In android bumblebee Just add this code on top in the build.gradle <Project .> file在 android bumblebee 中只需在 build.gradle <Project .> 文件的顶部添加此代码
buildscript {
dependencies {
classpath 'com.google.gms:google-services:4.3.10'
}
}
Now try to add plugin in build.gradle <app .> like this现在尝试像这样在 build.gradle <app .> 中添加插件
plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
id 'com.google.gms.google-services'
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.