java将Firebase gcm添加到项目中
我想将Firebase添加到我的项目中以使用推送通知
在家里,我通过在build中添加这一行来实现它。格雷德尔(应用程序)
apply plugin: 'com.google.gms.google-services'
这条线是我的身材。年级(项目):
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.安卓.gms:play-services:9.6.1'
}
有没有办法将play services类添加到gradel cash中,以便离线工作
注: 我已经尝试更新到sdk 24和构建工具24.0.3 不要用太多的拖线,但我一直得到一个错误,fire base从未初始化,我需要使用这个:
firebase.initializeApp(context)
我确实在应用程序上下文中使用了,但没有起作用
注2: 我的身材。gradel(项目)将jcenter作为存储库
repositories {
jcenter()
}
# 1 楼答案
在构建中添加以下代码。格拉德尔(项目)