接入firebase
This commit is contained in:
parent
d7b0481abd
commit
9fb365d92e
@ -3,6 +3,8 @@ import java.util.Date
|
|||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
alias(libs.plugins.android.application)
|
alias(libs.plugins.android.application)
|
||||||
|
id("com.google.gms.google-services")
|
||||||
|
id("com.google.firebase.crashlytics")
|
||||||
}
|
}
|
||||||
val timestamp = SimpleDateFormat("MM_dd_HH_mm").format(Date())
|
val timestamp = SimpleDateFormat("MM_dd_HH_mm").format(Date())
|
||||||
android {
|
android {
|
||||||
@ -13,13 +15,16 @@ android {
|
|||||||
viewBinding = true
|
viewBinding = true
|
||||||
}
|
}
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId = "com.key.vibekeyboard"
|
applicationId = "com.key.vibekeyboard"
|
||||||
minSdk = 23
|
minSdk = 23
|
||||||
targetSdk = 34
|
targetSdk = 34
|
||||||
versionCode = 1
|
versionCode = 1
|
||||||
versionName = "1.0.0"
|
versionName = "1.0.0"
|
||||||
setProperty("archivesBaseName", "Mobile Keyboard" + versionName + "(${versionCode})_$timestamp")
|
setProperty(
|
||||||
|
"archivesBaseName",
|
||||||
|
"Mobile Keyboard" + versionName + "(${versionCode})_$timestamp"
|
||||||
|
)
|
||||||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -48,13 +53,23 @@ dependencies {
|
|||||||
androidTestImplementation(libs.ext.junit)
|
androidTestImplementation(libs.ext.junit)
|
||||||
androidTestImplementation(libs.espresso.core)
|
androidTestImplementation(libs.espresso.core)
|
||||||
// Room 运行时库
|
// Room 运行时库
|
||||||
implementation ("androidx.room:room-runtime:2.6.1")
|
implementation("androidx.room:room-runtime:2.6.1")
|
||||||
// Room 编译器,用于生成代码
|
// Room 编译器,用于生成代码
|
||||||
annotationProcessor ("androidx.room:room-compiler:2.6.1")
|
annotationProcessor("androidx.room:room-compiler:2.6.1")
|
||||||
// Glide 依赖
|
// Glide 依赖
|
||||||
implementation ("com.github.bumptech.glide:glide:4.16.0")
|
implementation("com.github.bumptech.glide:glide:4.16.0")
|
||||||
//Zip
|
//Zip
|
||||||
implementation("com.github.omicronapps:7-Zip-JBinding-4Android:Release-16.02-2.02")
|
implementation("com.github.omicronapps:7-Zip-JBinding-4Android:Release-16.02-2.02")
|
||||||
|
|
||||||
|
|
||||||
|
// Import the BoM for the Firebase platform
|
||||||
|
implementation(platform("com.google.firebase:firebase-bom:33.6.0"))
|
||||||
|
|
||||||
|
// Add the dependencies for the Crashlytics and Analytics libraries
|
||||||
|
// When using the BoM, you don't specify versions in Firebase library dependencies
|
||||||
|
implementation("com.google.firebase:firebase-crashlytics")
|
||||||
|
implementation("com.google.firebase:firebase-analytics")
|
||||||
|
implementation("com.google.firebase:firebase-config")
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
29
app/google-services.json
Normal file
29
app/google-services.json
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
{
|
||||||
|
"project_info": {
|
||||||
|
"project_number": "480699017036",
|
||||||
|
"project_id": "mobile-keyboard-e527a",
|
||||||
|
"storage_bucket": "mobile-keyboard-e527a.firebasestorage.app"
|
||||||
|
},
|
||||||
|
"client": [
|
||||||
|
{
|
||||||
|
"client_info": {
|
||||||
|
"mobilesdk_app_id": "1:480699017036:android:bb1e5d95fac488d87a51e9",
|
||||||
|
"android_client_info": {
|
||||||
|
"package_name": "com.key.vibekeyboard"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"oauth_client": [],
|
||||||
|
"api_key": [
|
||||||
|
{
|
||||||
|
"current_key": "AIzaSyCfnLHjdKzPePbdUvB-VzlV3s750tPLf2E"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"services": {
|
||||||
|
"appinvite_service": {
|
||||||
|
"other_platform_oauth_client": []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"configuration_version": "1"
|
||||||
|
}
|
||||||
@ -2,7 +2,9 @@ package com.key.vibekeyboard;
|
|||||||
|
|
||||||
import android.app.Application;
|
import android.app.Application;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.util.Log;
|
||||||
|
|
||||||
|
import com.google.firebase.FirebaseApp;
|
||||||
import com.key.vibekeyboard.Room.Category;
|
import com.key.vibekeyboard.Room.Category;
|
||||||
import com.key.vibekeyboard.Room.MyDatabase;
|
import com.key.vibekeyboard.Room.MyDatabase;
|
||||||
import com.key.vibekeyboard.Room.WallpaperInfo;
|
import com.key.vibekeyboard.Room.WallpaperInfo;
|
||||||
@ -20,12 +22,24 @@ public class AppApplication extends Application {
|
|||||||
|
|
||||||
public static final int DB_Version = 1;
|
public static final int DB_Version = 1;
|
||||||
public static final String DB_Name = "image_database";
|
public static final String DB_Name = "image_database";
|
||||||
|
|
||||||
|
public static final String TAG = "--------------";
|
||||||
@Override
|
@Override
|
||||||
public void onCreate() {
|
public void onCreate() {
|
||||||
super.onCreate();
|
super.onCreate();
|
||||||
instance = this;
|
instance = this;
|
||||||
categories = Mytool.parseJsonToList("keyboard.json");
|
categories = Mytool.parseJsonToList("keyboard.json");
|
||||||
|
|
||||||
|
// 确保Firebase初始化
|
||||||
|
// FirebaseApp.initializeApp(this);
|
||||||
|
//
|
||||||
|
// // 输出日志以确认Firebase初始化
|
||||||
|
// if (!FirebaseApp.getApps(this).isEmpty()) {
|
||||||
|
// Log.d(TAG, "Firebase 初始化成功");
|
||||||
|
// } else {
|
||||||
|
// Log.e(TAG, "Firebase 初始化失败");
|
||||||
|
// }
|
||||||
|
|
||||||
Mytool.runIO(new Runnable() {
|
Mytool.runIO(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
|||||||
@ -1,4 +1,7 @@
|
|||||||
// 顶级构建文件,用于添加所有子项目/模块的公共配置选项
|
// 顶级构建文件,用于添加所有子项目/模块的公共配置选项
|
||||||
plugins {
|
plugins {
|
||||||
alias(libs.plugins.android.application) apply false
|
alias(libs.plugins.android.application) apply false
|
||||||
|
|
||||||
|
id("com.google.gms.google-services") version "4.4.2" apply false
|
||||||
|
id ("com.google.firebase.crashlytics") version "3.0.2" apply false
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user