[英]android push notifications library with google cloud messaging
i am working on an android using GCM application and adding support libraries,i added the following to my gradle 我正在使用GCM应用程序并添加支持库在android上工作,我在gradle中添加了以下内容
i added a plugin 我添加了一个插件
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
and dependencies: i added: 和依赖项:我添加了:
compile 'com.google.android.gms:play-services:8.3.0'
classpath 'com.google.gms:google-services:3.0.0'
but it brings an error 但这带来了一个错误
Error:(3, 0) Plugin with id 'com.google.gms.google-services' not found.
and yet i see the plugin added. 但是我看到插件添加了。 how to i correct it thank you
我如何纠正它,谢谢
In your project level build.gradle
add like following: 在您的项目级别
build.gradle
添加如下内容:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.2'
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
}
}
While your App level build.gradle
should look like this: 虽然您的应用程序级别
build.gradle
应该如下所示:
apply plugin: 'com.android.application'
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile "com.google.android.gms:play-services-gcm:8.3.0"
}
apply plugin: 'com.google.gms.google-services'
Make sure to add apply plugin: 'com.google.gms.google-services'
as last line in your app level gradle file. 确保在应用程序级别gradle文件的最后一行添加
apply plugin: 'com.google.gms.google-services'
。
You should only apply the com.android.application plugin. 您应该只应用com.android.application插件。
Applying the java plugin as well will result in a build error. 应用Java插件也会导致生成错误。 Reference : http://tools.android.com/tech-docs/new-build-system/user-guide
参考: http : //tools.android.com/tech-docs/new-build-system/user-guide
The dependencies you have added are fine. 您添加的依赖关系很好。 You can remove the "apply plugin: 'com.google.gms.google-services'" entry.
您可以删除“应用插件:'com.google.gms.google-services'”条目。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.