Skip to content

Commit

Permalink
feat: Enabled Crashlytics for Play Store builds
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
BobbyESP committed Jul 31, 2024
1 parent 8f16bd9 commit 51b943d
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 18 deletions.
15 changes: 11 additions & 4 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import com.google.firebase.crashlytics.buildtools.gradle.CrashlyticsExtension
import java.util.Properties

val isFullBuild: Boolean by rootProject.extra
Expand Down Expand Up @@ -70,7 +71,7 @@ android {
"String", "CLIENT_SECRET", "\"${localProperties.getProperty("CLIENT_SECRET")}\""
)
isMinifyEnabled = false
applicationIdSuffix = ".debug"
// applicationIdSuffix = ".debug"
}
}

Expand All @@ -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<CrashlyticsExtension> {
mappingFileUploadEnabled = false //Todo: SET TO TRUE WHEN FIXED
nativeSymbolUploadEnabled = false
}
}

create("foss") {
Expand Down Expand Up @@ -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)
Expand Down
7 changes: 3 additions & 4 deletions app/src/playstore/kotlin/FirebaseSetup.kt
Original file line number Diff line number Diff line change
@@ -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)
}
12 changes: 5 additions & 7 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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) }
}
5 changes: 2 additions & 3 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -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"
Expand Down Expand Up @@ -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" }
Expand Down Expand Up @@ -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"]
Expand Down

0 comments on commit 51b943d

Please sign in to comment.