Firebase核心庫集成
Firebase平臺(tái)適用于創(chuàng)建對應(yīng)谷歌項(xiàng)目俯艰,并集成谷歌特殊功能的平臺(tái)助泽。
項(xiàng)目創(chuàng)建
添加應(yīng)用
獲取應(yīng)用的SHA-1值:
SDK集成
Project/build gradle配置:
buildscript {
repositories {
jcenter()
//需配置
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.2'
//需配置
classpath 'com.google.gms:google-services:4.2.0'
}
}
allprojects {
repositories {
maven { url "https://maven.google.com"}
maven { url 'https://jitpack.io' }
mavenCentral()
jcenter()
//需配置
google()
}
}
-
app/build gradle配置:
apply plugin: 'com.android.application'
android {
// ...
}
dependencies {
// 核心庫的集成
implementation 'com.google.firebase:firebase-core:17.0.0'
}
// Add the following line to the bottom of the file:
apply plugin: 'com.google.gms.google-services' // Google Play services Gradle plugin