目录

Android 接入firebase

注册firebase账号

在 上注册登陆账号,之后注册应用,填写包名等信息,下载配置文件。

下载配置文件

google-services.json

添加 Firebase SDK

适用于 Gradle 的说明|  的 Google 服务插件会加载您刚刚下载的 google-services.json 文件。请修改您的 build.gradle 文件以使用该插件。 项目级 build.gradle(<项目>/build.gradle):

buildscript {
dependencies {
// Add this line
classpath 'com.google.gms:google-services:4.0.0' }
}

应用级 build.gradle(<项目>/<应用模块>/build.gradle):

dependencies {
// Add this line
compile 'com.google.firebase:firebase-core:16.0.0'
}
...
// Add to the bottom of the file
apply plugin: 'com.google.gms.google-services'

默认情况下包含 Analytics 最后,按 IDE 中显示的栏中的“立即同步”: https://www.gstatic.com/mobilesdk/160330_mobilesdk/images/android_studio_gradle_changed_butterbar@2x.png