簡體   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