简体   繁体   English

带有Google Cloud消息传递的android推送通知库

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

相关问题 使用XMPP服务器和Google云消息传递(或更新的Firebase云消息传递)进行推送通知的Android应用程序App - Chat App for Android using a XMPP Server and Google Cloud Messaging (or the newer Firebase Cloud Messaging) for Push Notifications 在谷歌云消息传递为Android - In Google cloud messaging for android 错误-使用Google Cloud Messaging(GCM)的Android Push Notification - ERROR - Android Push Notification using Google Cloud Messaging (GCM) 使用Java将HTTP发布到Google Cloud Messaging(Android推送通知) - HTTP Post to Google Cloud Messaging (Android Push Notification) using Java 在Android SDK管理器中找不到Google云消息传递(GCM)库 - Google cloud messaging (GCM) library not found in Android SDK manager 无法将Google Cloud Messaging集成到Android库模块中 - Unable to integrate Google Cloud Messaging in an android library module Android推送通知未使用Firebase云消息传递或任何其他类似服务 - Android Push Notifications Without using Firebase Cloud Messaging or any other similar service Android:Android推送通知应该使用什么? Google Cloud Messaging或Parse.com - Android: what should I use for android push notification? Google Cloud Messaging or Parse.com 如何实现Google Cloud Messaging发送推送通知Android Studio的服务器 - How to implementing server for Google Cloud Messaging to send Push notification android studio Google Cloud Messaging开发人员android代码崩溃 - Google Cloud Messaging developer android code crashing
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM