2016-10-16 78 views
-1

我要火力地堡添加到我的項目在家裏使用推送通知添加火力地堡GCM項目

我實現它通過的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. 

,所以我不能構建項目

我需要一種方法來實現這一點沒有插件和CLASSPATH

我使用

compileSdkVersion 23 
    buildToolsVersion "23.0.3" 

我depndecies : 依賴{

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() 
    } 
+0

火力地堡和谷歌Play服務庫在您的Android SDK Manager中的Google Repository中。他們在你的本地驅動器上。然而,你需要'jcenter()'(或者有時候只需要'mavenCentral()')存儲庫來存放其他庫。按照建議調整您的代理設置。聯繫您的網絡管理員。 –

回答

0

添加以下代碼的build.gradle(項目)

repositories { 
     jcenter() 
} 
+0

它增加了@Rissmon –