Firebase

1.首先前往firebase.google.com注册账号,必须使用Gmail账户;

2.进入firebase console,create new project,进入project, Add an app,选择Android;

3.在Android Studio中打开Manifest文件,复制package name;

4.在Android Studio右侧的Gradle面板中运行app-> Tasks-> Android -> SingningReport,复制SHA1

5.点击REGISTER APP, 进入Download config file,下载google-services.json;

6.将Android Studio左侧的视图切换为Project,然后将google-services.json移动到app 文件件下;

7.点击continue,进入Add Firebase SDK;

8.最后一步,添加Denpendces

在project build.gradle中添加

classpath 'com.google.gms:google-services:3.0.0'

在app build.gradle中的最后一行添加

apply plugin: 'com.google.gms.google-services'

另外需要添加你需要使用的firebase模块,可以在firebase的Documentation中的guides中找到模块列表

Gradle Dependency LineService
com.google.firebase:firebase-core:10.2.1 Analytics
com.google.firebase:firebase-database:10.2.1 Realtime Database
com.google.firebase:firebase-storage:10.2.1 Storage
com.google.firebase:firebase-crash:10.2.1 Crash Reporting
com.google.firebase:firebase-auth:10.2.1 Authentication
com.google.firebase:firebase-messaging:10.2.1 Cloud Messaging and Notifications
com.google.firebase:firebase-config:10.2.1 Remote Config
com.google.firebase:firebase-invites:10.2.1 Invites and Dynamic Links
com.google.firebase:firebase-ads:10.2.1 AdMob
com.google.firebase:firebase-appindexing:10.2.1 App Indexing

9.最后一步,Sync Gradle。

 

*在Android Studio的Tools中打开Firebase的Assistant,使用'Connect to Firebase'连接项目,里面有所有内容的guides,非常方便使用




posted @ 2017-04-10 14:56  火热火热7  阅读(812)  评论(0)    收藏  举报