繁体   English   中英

将 Firebase gcm 添加到项目

[英]Add Firebase gcm to project

我想将 Firebase 添加到我的项目以使用推送通知

在家里我通过在 build.gradle (app) 添加这一行来实现它

   apply plugin: 'com.google.gms.google-services'

在我的 build.gradel (项目)中的这一行:

   classpath 'com.google.gms:google-services:3.0.0'

它奏效了。

由于代理原因在工作时,我无法连接到 jcenter 并收到此错误:

Unknown host 'jcenter.bintray.com'. You may need to adjust the proxy settings in Gradle.

所以我无法构建项目

我需要一种没有插件和类路径的方法来实现这个

我正在使用

  compileSdkVersion 23
  buildToolsVersion "23.0.3"

我的依赖:依赖{

compile 'com.google.firebase:firebase-core:9.0.0'
compile 'com.google.firebase:firebase-messaging:9.0.0'
compile 'com.google.android.gms:play-services:9.6.1'
} 

有没有办法将游戏服务类添加到等级现金中以便能够离线工作

注意:我尝试更新到 sdk 24 并构建工具 24.0.3 并且不使用 thouse 拖车线,但我不断收到错误消息,即从未初始化过火力基地,我需要使用它:

firebase.initializeApp(context)

我确实在应用程序上下文中使用过但没有用

注 2:我的 build.gradel(项目)有 jcenter 作为存储库

repositories {
    jcenter()
    } 

在 build.gradle(project) 中添加以下代码

  repositories {
        jcenter()
 }

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM