FireBase-Android

  • 1. 在FireBase控制台建立專案螢幕快照 2016-10-08 下午5.05.40
  • 2. 下載google-services.json到Project
  • 3. 在專案的build.gradle加入以下code,導入google services plugin
buildscript {
    // ...
    dependencies {
        // ...
        classpath 'com.google.gms:google-services:3.0.0'
    }
}
  • 4.在moudle的Build.gradle中加入
apply plugin: 'com.android.application'

android {
  // ...
}

dependencies {
  // ...
  compile 'com.google.firebase:firebase-core:9.6.1'
  // Getting a "Could not find" error? Make sure you have
  // the latest Google Repository in the Android SDK manager
}

// 這行一定要放在dependencies後面,不然會出錯,原因不知道...
apply plugin: 'com.google.gms.google-services'
  • 5.這樣就完成基本的設定,可以開始玩FireBase

官方教學