最近Firebase推出了一项新功能,但我在使用时遇到了问题。我的应用之前已经使用了Firebase,现在想要添加存储功能。因此,我将依赖项添加到了gradle文件中:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.firebase:firebase-client-android:2.5.2+'
compile 'com.firebase:geofire:1.1.0+'
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.2.0'
compile 'com.android.support:design:23.2.0'
compile 'com.google.android.gms:play-services-location:9.0.0'
compile 'com.google.firebase:firebase-storage:9.0.0' }
以下是我添加的内容:
apply plugin: 'com.google.gms.google-services'
因为我之前没有使用过谷歌服务插件,所以缺少google-services.json文件。如此处所述,我应该通过指定应用程序使用的服务来从谷歌获取此文件。然而,我只使用了Places API,而在此处我只能指定“登录”,“云消息传递”,“分析”,“应用邀请”和“Ad Mob”: https://developers.google.com/mobile/add