From 51b943d4c76522847d443a66d5de0ccf0bfe0a2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Font=C3=A1n?= Date: Thu, 1 Aug 2024 00:30:43 +0200 Subject: [PATCH] feat: Enabled Crashlytics for Play Store builds MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit enables Crashlytics for Play Store builds by applying the Google Services and Firebase Crashlytics plugins to the "playstore" product flavor. It also sets up Crashlytics with mappingFileUploadEnabled and nativeSymbolUploadEnabled set to false. The Firebase Crashlytics Gradle plugin version has been downgraded from 3.0.2 to 2.9.0. Signed-off-by: Gabriel Fontán --- app/build.gradle.kts | 15 +++++++++++---- app/src/playstore/kotlin/FirebaseSetup.kt | 7 +++---- build.gradle.kts | 12 +++++------- gradle/libs.versions.toml | 5 ++--- 4 files changed, 21 insertions(+), 18 deletions(-) diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 266adcd..1ef95a1 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -1,3 +1,4 @@ +import com.google.firebase.crashlytics.buildtools.gradle.CrashlyticsExtension import java.util.Properties val isFullBuild: Boolean by rootProject.extra @@ -70,7 +71,7 @@ android { "String", "CLIENT_SECRET", "\"${localProperties.getProperty("CLIENT_SECRET")}\"" ) isMinifyEnabled = false - applicationIdSuffix = ".debug" +// applicationIdSuffix = ".debug" } } @@ -79,6 +80,12 @@ android { productFlavors { create("playstore") { dimension = "version" + apply(plugin = libs.plugins.google.gms.get().pluginId) + apply(plugin = libs.plugins.firebase.crashlytics.get().pluginId) + configure { + mappingFileUploadEnabled = false //Todo: SET TO TRUE WHEN FIXED + nativeSymbolUploadEnabled = false + } } create("foss") { @@ -173,9 +180,9 @@ dependencies { implementation(libs.landscapist.coil) //-------------------FIREBASE-------------------// -// "playstoreImplementation"(platform(libs.firebase.bom)) -// "playstoreImplementation"(libs.firebase.analytics) -// "playstoreImplementation"(libs.firebase.crashlytics) + "playstoreImplementation"(platform(libs.firebase.bom)) + "playstoreImplementation"(libs.firebase.analytics) + "playstoreImplementation"(libs.firebase.crashlytics) //-------------------Utilities-------------------// implementation(libs.kotlinx.collections.immutable) diff --git a/app/src/playstore/kotlin/FirebaseSetup.kt b/app/src/playstore/kotlin/FirebaseSetup.kt index 629611f..6fa49d3 100644 --- a/app/src/playstore/kotlin/FirebaseSetup.kt +++ b/app/src/playstore/kotlin/FirebaseSetup.kt @@ -1,8 +1,7 @@ import com.bobbyesp.metadator.MainActivity - -//import com.google.firebase.Firebase -//import com.google.firebase.crashlytics.crashlytics +import com.google.firebase.Firebase +import com.google.firebase.crashlytics.crashlytics fun MainActivity.setupFirebase() { -// Firebase.crashlytics.setCrashlyticsCollectionEnabled(true) + Firebase.crashlytics.setCrashlyticsCollectionEnabled(true) } \ No newline at end of file diff --git a/build.gradle.kts b/build.gradle.kts index 033006b..aad5195 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -9,13 +9,11 @@ plugins { alias(libs.plugins.kotlin.ksp) apply false alias(libs.plugins.compose.compiler) apply false alias(libs.plugins.androidTest) apply false + + alias(libs.plugins.google.gms) apply false + alias(libs.plugins.firebase.crashlytics) apply false } -buildscript { - val isFullBuild by extra { - gradle.startParameter.taskNames.none { task -> task.contains("foss", ignoreCase = true) } - } - dependencies { - classpath(libs.gradle) - } +val isGoogleMobileServicesBuild by extra { + gradle.startParameter.taskNames.none { task -> task.contains("foss", ignoreCase = true) } } \ No newline at end of file diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index a319a5a..68f0977 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,7 +1,7 @@ [versions] #General, lifecycle and core agp = "8.7.0-alpha02" -firebaseCrashlyticsGradle = "3.0.2" +firebaseCrashlyticsGradle = "2.9.0" gradle = "8.7.0-alpha02" kotlin = "2.0.0" appcompat = "1.7.0" @@ -93,7 +93,6 @@ firebase-crashlytics-gradle = { group = "com.google.firebase", name = "firebase- lifecycle-runtime-ktx = { group = "androidx.lifecycle", name = "lifecycle-runtime-ktx", version.ref = "lifecycle-runtime-ktx" } lifecycle-compose-runtime = { group = "androidx.lifecycle", name = "lifecycle-runtime-compose", version.ref = "lifecycle-runtime-ktx" } lifecycle-compose-viewModel = { group = "androidx.lifecycle", name = "lifecycle-viewmodel-compose", version.ref = "lifecycle-runtime-ktx" } -gradle = { module = "com.android.tools.build:gradle", version.ref = "gradle" } #Compose UI compose-graphics = { group = "androidx.compose.ui", name = "ui-graphics" } @@ -216,8 +215,8 @@ hilt = { id = "com.google.dagger.hilt.android", version.ref = "hilt" } compose-compiler = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" } androidTest = { id = "com.android.test", version.ref = "agp" } firebase-crashlytics = { id = "com.google.firebase.crashlytics", version.ref = "firebaseCrashlyticsGradle" } -androidx-baselineprofile = { id = "androidx.baselineprofile", version.ref = "androidx-baselineprofile" } google-gms = { id = "com.google.gms.google-services", version.ref = "googleServices" } +androidx-baselineprofile = { id = "androidx.baselineprofile", version.ref = "androidx-baselineprofile" } [bundles] core = ["core-ktx", "lifecycle-runtime-ktx", "lifecycle-compose-runtime", "lifecycle-compose-viewModel", "activity-compose", "core-appcompat", "core-splashscreen"]