Skip to content

Commit

Permalink
fix: Enabled Crashlytics mapping file upload
Browse files Browse the repository at this point in the history
This commit enables the upload of Crashlytics mapping files, allowing for more detailed and accurate crash reports. It
 also updates some dependencies to their latest versions.

Specifically, this commit:

- Enables `mappingFileUploadEnabled` and `nativeSymbolUploadEnabled` in the Crashlytics configuration for the Play Store build.
- Updates the Firebase BOM to version 33.1.2.
- Updates the Android Gra
dle Plugin to version 8.5.1.
- Removes the unnecessary `material` dependency.
- Moves the Firebase initialization to the `playstore` flavor.
- Removes the unnecessary `initializeFirebase` call from the `App` class.
- Updates the Compose BOM to the stable version.
- Applies the Google Services and Firebase Crashlytics plugins only to the `playstore` flavor.
- Changes the `playstoreImplementation` dependency to `playstoreApi` for Firebase libraries.
- Removes the `setCrashlyticsCollection` function from `MainActivity` and makes it a top-level function
.
- Fixes the crash in the Play Store release version thanks to [this issue](firebase/firebase-android-sdk#6146)

Signed-off-by: Gabriel Fontán <[email protected]>
  • Loading branch information
BobbyESP committed Aug 5, 2024
1 parent ae8b9cd commit da765f3
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 17 deletions.
18 changes: 8 additions & 10 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,6 @@ plugins {
alias(libs.plugins.compose.compiler)
}

if (isGoogleMobileServicesBuild) {
apply(plugin = libs.plugins.google.gms.get().pluginId)
apply(plugin = libs.plugins.firebase.crashlytics.get().pluginId)
}

val commitSignature = providers.exec {
commandLine("git", "rev-parse", "--short", "HEAD")
}.standardOutput.asText.get().substringBefore("\n")
Expand Down Expand Up @@ -85,16 +80,19 @@ 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
mappingFileUploadEnabled = true
nativeSymbolUploadEnabled = true
}
}

create("foss") {
dimension = "version"
}
}

compileOptions {
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
Expand Down Expand Up @@ -143,7 +141,7 @@ dependencies {

//---------------User Interface---------------//
//Core UI libraries
api(platform(libs.compose.bom.canary))
api(platform(libs.compose.bom))

//Accompanist libraries
implementation(libs.bundles.accompanist)
Expand All @@ -157,7 +155,7 @@ dependencies {
//-------------------Network-------------------//
implementation(libs.bundles.ktor)

// //---------------Media3---------------//
//---------------Media3---------------//
implementation(libs.bundles.media3)
implementation(libs.androidx.media3.datasource.okhttp)
implementation(project(":app:mediaplayer"))
Expand All @@ -183,7 +181,7 @@ dependencies {
implementation(libs.landscapist.coil)

//-------------------FIREBASE-------------------//
"playstoreImplementation"(platform(libs.firebase.bom))
"playstoreApi"(platform(libs.firebase.bom))
"playstoreImplementation"(libs.firebase.analytics)
"playstoreImplementation"(libs.firebase.crashlytics)

Expand Down
2 changes: 0 additions & 2 deletions app/src/main/java/com/bobbyesp/metadator/App.kt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import com.bobbyesp.crashhandler.CrashHandler.setupCrashHandler
import com.bobbyesp.crashhandler.ReportInfo
import com.tencent.mmkv.MMKV
import dagger.hilt.android.HiltAndroidApp
import initializeFirebase
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.SupervisorJob
import kotlin.properties.Delegates
Expand All @@ -20,7 +19,6 @@ import kotlin.properties.Delegates
class App : Application() {
override fun onCreate() {
MMKV.initialize(this)
initializeFirebase()
packageInfo = packageManager.run {
if (Build.VERSION.SDK_INT >= 33) getPackageInfo(
packageName, PackageManager.PackageInfoFlags.of(0)
Expand Down
3 changes: 1 addition & 2 deletions app/src/playstore/kotlin/FirebaseSetup.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import com.bobbyesp.metadator.App
import com.bobbyesp.metadator.MainActivity
import com.google.firebase.Firebase
import com.google.firebase.crashlytics.crashlytics
import com.google.firebase.initialize
Expand All @@ -14,6 +13,6 @@ fun App.initializeFirebase() {
* This function sets the Crashlytics collection to be enabled, allowing Firebase Crashlytics
* to collect crash reports for the application.
*/
fun MainActivity.setCrashlyticsCollection() {
fun setCrashlyticsCollection() {
Firebase.crashlytics.setCrashlyticsCollectionEnabled(true)
}
5 changes: 2 additions & 3 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[versions]
#General, lifecycle and core
agp = "8.7.0-alpha02"
agp = "8.5.1"
firebaseCrashlyticsGradle = "3.0.2"
kotlin = "2.0.0"
appcompat = "1.7.0"
Expand Down Expand Up @@ -59,7 +59,7 @@ mmkv = "1.3.9"
#Firebase, GMS...
gmsPlayServicesAuth = "21.2.0"
googleServices = "4.4.2"
firebaseBom = "33.1.1"
firebaseBom = "33.1.2"

#Spotify API
spotify-apiHandler = "4.1.3"
Expand All @@ -78,7 +78,6 @@ androidx-baselineprofile = "1.2.4"
profileinstaller = "1.3.1"
media3DatasourceOkhttp = "1.4.0"
scrollbar = "2.2.0"
material = "1.12.0"

[libraries]
#Core libraries
Expand Down

0 comments on commit da765f3

Please sign in to comment.