【问题标题】:Add Firebase gcm to project将 Firebase gcm 添加到项目
【发布时间】:2016-10-16 13:22:04
【问题描述】:

我想将 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'
} 

有没有办法将游戏服务课程添加到 Gradel Cash 中以便能够离线工作

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

firebase.initializeApp(context)

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

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

repositories {
    jcenter()
    } 

【问题讨论】:

  • Firebase 和 Google Play 服务库位于 Android SDK 管理器的 Google 存储库中。它们在您的本地驱动器上。但是,您需要任何其他库的 jcenter()(或有时只是 mavenCentral())存储库。按照建议调整您的代理设置。请联系您的网络管理员。

标签: java android firebase firebase-cloud-messaging


【解决方案1】:

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

  repositories {
        jcenter()
 }

【讨论】:

  • 添加了@Rissmon
猜你喜欢
  • 2016-11-02
  • 2021-11-09
  • 1970-01-01
  • 2020-02-06
  • 2020-11-27
  • 1970-01-01
  • 2019-10-02
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多