Fix crashlytics while using custom global exception handler (#338)
* Add crashlytics to standard builds (cherry picked from commit 3c611b95fb79e5ac972019b76c7b24f46a3087fd) * Testing crashlytics * working * cleanup * Revert "Auxiliary commit to revert individual files from 84232c7fe229bf557680a787fa02c055ca18dc66" This reverts commit 2c9b6277b276f108a25e90e6be9a227440136063. * Revert "Auxiliary commit to revert individual files from cf3f5fe1586f40fabf5b75a649ab332282608a08" This reverts commit 708f6b1d3803374b0440d163560a682f0cfc618e. * Only send crashlytics on Standard & Release/Preview build --------- Co-authored-by: AntsyLich <59261191+AntsyLich@users.noreply.github.com>
This commit is contained in:
parent
6d4a7f02de
commit
ffd5b4ebc1
9 changed files with 27 additions and 27 deletions
|
|
@ -16,9 +16,10 @@ plugins {
|
|||
}
|
||||
|
||||
if (gradle.startParameter.taskRequests.toString().contains("Standard")) {
|
||||
pluginManager.apply(libs.plugins.google.services.get().pluginId)
|
||||
// Firebase Crashlytics
|
||||
apply(plugin = "com.google.firebase.crashlytics")
|
||||
pluginManager.apply {
|
||||
apply(libs.plugins.google.services.get().pluginId)
|
||||
apply(libs.plugins.firebase.crashlytics.get().pluginId)
|
||||
}
|
||||
}
|
||||
|
||||
// shortcutHelper.setFilePath("./shortcuts.xml")
|
||||
|
|
@ -286,7 +287,9 @@ dependencies {
|
|||
implementation(libs.logcat)
|
||||
|
||||
// Crash reports/analytics
|
||||
// "standardImplementation"(libs.firebase.analytics)
|
||||
implementation(platform(libs.firebase.bom))
|
||||
implementation(libs.firebase.analytics)
|
||||
implementation(libs.firebase.crashlytics)
|
||||
|
||||
// Shizuku
|
||||
implementation(libs.bundles.shizuku)
|
||||
|
|
@ -304,10 +307,6 @@ dependencies {
|
|||
// Text distance (EH)
|
||||
implementation(sylibs.simularity)
|
||||
|
||||
// Firebase (EH)
|
||||
implementation(sylibs.firebase.analytics)
|
||||
implementation(sylibs.firebase.crashlytics.ktx)
|
||||
|
||||
// Better logging (EH)
|
||||
implementation(sylibs.xlog)
|
||||
|
||||
|
|
|
|||
2
app/proguard-rules.pro
vendored
2
app/proguard-rules.pro
vendored
|
|
@ -167,6 +167,8 @@
|
|||
-keepattributes SourceFile,LineNumberTable
|
||||
-keep class com.crashlytics.** { *; }
|
||||
-dontwarn com.crashlytics.**
|
||||
-keep class com.google.firebase.crashlytics.** { *; }
|
||||
-keep public class * extends java.lang.Exception # Optional: Keep custom exceptions.
|
||||
|
||||
# === Humanize + Guava: https://github.com/google/guava/wiki/UsingProGuardWithGuava
|
||||
-dontwarn javax.lang.model.element.Modifier
|
||||
|
|
|
|||
|
|
@ -28,9 +28,8 @@ import com.elvishew.xlog.printer.AndroidPrinter
|
|||
import com.elvishew.xlog.printer.Printer
|
||||
import com.elvishew.xlog.printer.file.backup.NeverBackupStrategy
|
||||
import com.elvishew.xlog.printer.file.naming.DateFileNameGenerator
|
||||
import com.google.firebase.crashlytics.ktx.crashlytics
|
||||
import com.google.firebase.ktx.Firebase
|
||||
import com.google.firebase.ktx.initialize
|
||||
import com.google.firebase.Firebase
|
||||
import com.google.firebase.crashlytics.crashlytics
|
||||
import eu.kanade.domain.DomainModule
|
||||
import eu.kanade.domain.SYDomainModule
|
||||
import eu.kanade.domain.base.BasePreferences
|
||||
|
|
@ -102,7 +101,6 @@ class App : Application(), DefaultLifecycleObserver, SingletonImageLoader.Factor
|
|||
override fun onCreate() {
|
||||
super<Application>.onCreate()
|
||||
// KMK -->
|
||||
Firebase.initialize(this)
|
||||
if (BuildConfig.DEBUG) Timber.plant(Timber.DebugTree())
|
||||
// KMK <--
|
||||
|
||||
|
|
|
|||
|
|
@ -2,8 +2,6 @@ package eu.kanade.tachiyomi.crash
|
|||
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import com.google.firebase.crashlytics.ktx.crashlytics
|
||||
import com.google.firebase.ktx.Firebase
|
||||
import kotlinx.serialization.KSerializer
|
||||
import kotlinx.serialization.descriptors.PrimitiveKind
|
||||
import kotlinx.serialization.descriptors.PrimitiveSerialDescriptor
|
||||
|
|
@ -35,8 +33,11 @@ class GlobalExceptionHandler private constructor(
|
|||
override fun uncaughtException(thread: Thread, exception: Throwable) {
|
||||
try {
|
||||
logcat(priority = LogPriority.ERROR, throwable = exception)
|
||||
Firebase.crashlytics.recordException(exception)
|
||||
launchActivity(applicationContext, activityToBeLaunched, exception)
|
||||
// KMK -->
|
||||
// Pass the exception to Crashlytics
|
||||
defaultHandler.uncaughtException(thread, exception)
|
||||
// KMK <--
|
||||
exitProcess(0)
|
||||
} catch (_: Exception) {
|
||||
defaultHandler.uncaughtException(thread, exception)
|
||||
|
|
|
|||
|
|
@ -47,8 +47,8 @@ import cafe.adriel.voyager.navigator.Navigator
|
|||
import cafe.adriel.voyager.navigator.NavigatorDisposeBehavior
|
||||
import cafe.adriel.voyager.navigator.currentOrThrow
|
||||
import com.google.accompanist.systemuicontroller.rememberSystemUiController
|
||||
import com.google.firebase.analytics.ktx.analytics
|
||||
import com.google.firebase.ktx.Firebase
|
||||
import com.google.firebase.Firebase
|
||||
import com.google.firebase.analytics.analytics
|
||||
import eu.kanade.domain.base.BasePreferences
|
||||
import eu.kanade.domain.sync.SyncPreferences
|
||||
import eu.kanade.presentation.components.AppStateBanners
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
package exh.log
|
||||
|
||||
import com.elvishew.xlog.printer.Printer
|
||||
import com.google.firebase.crashlytics.ktx.crashlytics
|
||||
import com.google.firebase.ktx.Firebase
|
||||
import com.google.firebase.Firebase
|
||||
import com.google.firebase.crashlytics.crashlytics
|
||||
import eu.kanade.tachiyomi.BuildConfig
|
||||
|
||||
class CrashlyticsPrinter(private val logLevel: Int) : Printer {
|
||||
|
|
|
|||
|
|
@ -1,14 +1,14 @@
|
|||
buildscript {
|
||||
dependencies {
|
||||
// classpath(libs.android.shortcut.gradle)
|
||||
classpath(sylibs.firebase.crashlytics.gradle)
|
||||
classpath(sylibs.versionsx)
|
||||
classpath(sylibs.gradleversionsx)
|
||||
}
|
||||
}
|
||||
|
||||
plugins {
|
||||
alias(kotlinx.plugins.serialization) apply false
|
||||
alias(libs.plugins.aboutLibraries) apply false
|
||||
alias(libs.plugins.firebase.crashlytics) apply false
|
||||
alias(libs.plugins.google.services) apply false
|
||||
alias(libs.plugins.moko) apply false
|
||||
alias(libs.plugins.sqldelight) apply false
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ sqlite = "2.4.0"
|
|||
voyager = "1.0.0"
|
||||
spotless = "6.25.0"
|
||||
ktlint-core = "1.3.1"
|
||||
firebase-bom = "33.2.0"
|
||||
|
||||
[libraries]
|
||||
desugar = "com.android.tools:desugar_jdk_libs:2.1.2"
|
||||
|
|
@ -75,7 +76,9 @@ moko-core = { module = "dev.icerock.moko:resources", version.ref = "moko" }
|
|||
timber = "com.jakewharton.timber:timber:5.0.1"
|
||||
logcat = "com.squareup.logcat:logcat:0.1"
|
||||
|
||||
firebase-analytics = "com.google.firebase:firebase-analytics:22.1.0"
|
||||
firebase-bom = { module = "com.google.firebase:firebase-bom", version.ref = "firebase-bom" }
|
||||
firebase-analytics = { module = "com.google.firebase:firebase-analytics" }
|
||||
firebase-crashlytics = { module = "com.google.firebase:firebase-crashlytics" }
|
||||
|
||||
aboutLibraries-compose = { module = "com.mikepenz:aboutlibraries-compose-m3", version.ref = "aboutlib_version" }
|
||||
|
||||
|
|
@ -107,6 +110,7 @@ google-services = { id = "com.google.gms.google-services", version = "4.4.2" }
|
|||
aboutLibraries = { id = "com.mikepenz.aboutlibraries.plugin", version.ref = "aboutlib_version" }
|
||||
sqldelight = { id = "app.cash.sqldelight", version.ref = "sqldelight" }
|
||||
moko = { id = "dev.icerock.mobile.multiplatform-resources", version.ref = "moko" }
|
||||
firebase-crashlytics = { id = "com.google.firebase.crashlytics", version = "3.0.2" }
|
||||
|
||||
[bundles]
|
||||
okhttp = ["okhttp-core", "okhttp-logging", "okhttp-brotli", "okhttp-dnsoverhttps"]
|
||||
|
|
|
|||
|
|
@ -1,17 +1,13 @@
|
|||
[versions]
|
||||
|
||||
[libraries]
|
||||
firebase-analytics = "com.google.firebase:firebase-analytics:22.1.0"
|
||||
firebase-crashlytics-ktx = "com.google.firebase:firebase-crashlytics:19.0.3"
|
||||
firebase-crashlytics-gradle = "com.google.firebase:firebase-crashlytics-gradle:3.0.2"
|
||||
|
||||
simularity = "info.debatty:java-string-similarity:2.0.0"
|
||||
xlog = "com.elvishew:xlog:1.11.1"
|
||||
|
||||
ratingbar = "me.zhanghai.android.materialratingbar:library:1.4.0"
|
||||
composeRatingbar = "com.github.a914-gowtham:compose-ratingbar:1.3.12"
|
||||
|
||||
versionsx = "com.github.ben-manes:gradle-versions-plugin:0.51.0"
|
||||
gradleversionsx = "com.github.ben-manes:gradle-versions-plugin:0.51.0"
|
||||
|
||||
sqlcipher = "net.zetetic:sqlcipher-android:4.6.1"
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue