V1.0.4(6) 接入Firebase

This commit is contained in:
lihongwei 2024-10-18 18:06:15 +08:00
parent d804f5f396
commit ba82cb4755
5 changed files with 52 additions and 3 deletions

View File

@ -4,6 +4,8 @@ plugins {
alias(libs.plugins.android.application) alias(libs.plugins.android.application)
id ("org.jetbrains.kotlin.android") id ("org.jetbrains.kotlin.android")
kotlin("kapt") kotlin("kapt")
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 {
@ -15,8 +17,8 @@ android {
minSdk = 23 minSdk = 23
//noinspection OldTargetApi //noinspection OldTargetApi
targetSdk = 34 targetSdk = 34
versionCode = 5 versionCode = 6
versionName = "1.0.3" versionName = "1.0.4"
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
setProperty("archivesBaseName", "WallpapersHaven_V" + versionName + "(${versionCode})_$timestamp") setProperty("archivesBaseName", "WallpapersHaven_V" + versionName + "(${versionCode})_$timestamp")
} }
@ -57,6 +59,11 @@ dependencies {
androidTestImplementation(libs.espresso.core) androidTestImplementation(libs.espresso.core)
implementation(platform("com.google.firebase:firebase-bom:33.4.0"))
implementation("com.google.firebase:firebase-analytics-ktx")
implementation("com.google.firebase:firebase-crashlytics-ktx")
//-----------------------------------------------TopOn(Mintegral、Pangle、UnitAds、Digital Turbine(Fyber)、Chartboost&Helium、Ironsource、Liftoff(Vungle)、Inmobi、Start.io、Appnext、Bigo) //-----------------------------------------------TopOn(Mintegral、Pangle、UnitAds、Digital Turbine(Fyber)、Chartboost&Helium、Ironsource、Liftoff(Vungle)、Inmobi、Start.io、Appnext、Bigo)
//Anythink (Necessary) //Anythink (Necessary)

29
app/google-services.json Normal file
View File

@ -0,0 +1,29 @@
{
"project_info": {
"project_number": "723090727094",
"project_id": "wallpapers-haven",
"storage_bucket": "wallpapers-haven.appspot.com"
},
"client": [
{
"client_info": {
"mobilesdk_app_id": "1:723090727094:android:17d555cec5150f8569c617",
"android_client_info": {
"package_name": "com.app.wallpapershaven"
}
},
"oauth_client": [],
"api_key": [
{
"current_key": "AIzaSyAof2Szs0GY3YxzJ63ICLJ7TtHmCIJZCM8"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": []
}
}
}
],
"configuration_version": "1"
}

View File

@ -7,6 +7,7 @@ import android.util.Log;
import com.anythink.core.api.ATSDK; import com.anythink.core.api.ATSDK;
import com.anythink.core.api.NetTrafficeCallback; import com.anythink.core.api.NetTrafficeCallback;
import com.google.firebase.FirebaseApp;
import com.google.gson.Gson; import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken; import com.google.gson.reflect.TypeToken;
import com.lh.wallpaper2.file.ReadFile; import com.lh.wallpaper2.file.ReadFile;
@ -37,6 +38,16 @@ public class Wallpaper extends Application {
super.onCreate(); super.onCreate();
mAppContext = this; mAppContext = this;
// // 确保Firebase初始化
// FirebaseApp.initializeApp(this);
//
// // 输出日志以确认Firebase初始化
// if (!FirebaseApp.getApps(this).isEmpty()) {
// Log.d(TAG, "Firebase 初始化成功");
// } else {
// Log.e(TAG, "Firebase 初始化失败");
// }
initSDk(); initSDk();
try { try {

View File

@ -3,4 +3,6 @@ plugins {
alias(libs.plugins.android.application) apply false alias(libs.plugins.android.application) apply false
id("org.jetbrains.kotlin.android") version "1.9.0" apply false id("org.jetbrains.kotlin.android") version "1.9.0" apply false
kotlin("kapt") version "1.9.0" kotlin("kapt") version "1.9.0"
id("com.google.gms.google-services") version "4.4.2" apply false
id ("com.google.firebase.crashlytics") version "3.0.2" apply false
} }

View File

@ -6,7 +6,7 @@
# http://www.gradle.org/docs/current/userguide/build_environment.html # http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process. # Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings. # The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8 org.gradle.jvmargs=-Xmx4096m -Dfile.encoding=UTF-8
# When configured, Gradle will run in incubating parallel mode. # When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. For more details, visit # This option should only be used with decoupled projects. For more details, visit
# https://developer.android.com/r/tools/gradle-multi-project-decoupled-projects # https://developer.android.com/r/tools/gradle-multi-project-decoupled-projects