feature: integrate Sentry SDK for crash reporting on Android and iOS
This commit is contained in:
@@ -1,10 +1,5 @@
|
||||
# Android app
|
||||
|
||||
## Crash logging
|
||||
|
||||
GlitchTip is configured in the project. It uses the open source solution Senstry to log crashes
|
||||
generated by the app and send them to GlitchTip on a European server.
|
||||
|
||||
## StrictMode (debug builds)
|
||||
|
||||
The app enables Android [StrictMode](https://developer.android.com/reference/android/os/StrictMode)
|
||||
|
||||
@@ -31,9 +31,6 @@ dependencies {
|
||||
implementation(libs.androidx.activity.compose)
|
||||
implementation(libs.compose.uiToolingPreview)
|
||||
debugImplementation(libs.compose.uiTooling)
|
||||
|
||||
// Crash logging
|
||||
implementation(libs.glitchtips)
|
||||
}
|
||||
|
||||
android {
|
||||
@@ -55,10 +52,6 @@ android {
|
||||
.toInt()
|
||||
versionCode = 1
|
||||
versionName = "1.0.0-alpha02"
|
||||
|
||||
// Crash-reporting DSN, kept out of the public repo: read from local.properties
|
||||
// (glitchtip.dsn=...). Empty when absent, which disables the Sentry SDK.
|
||||
manifestPlaceholders["glitchtipDsn"] = localProperty("glitchtip.dsn") ?: ""
|
||||
}
|
||||
packaging {
|
||||
resources {
|
||||
@@ -76,12 +69,3 @@ android {
|
||||
targetCompatibility = JavaVersion.VERSION_11
|
||||
}
|
||||
}
|
||||
|
||||
/** Reads a key from the root local.properties, or null when the file or key is absent. */
|
||||
fun localProperty(key: String): String? {
|
||||
val file = rootProject.file("local.properties")
|
||||
if (!file.exists()) return null
|
||||
return Properties()
|
||||
.apply { file.inputStream().use { load(it) } }
|
||||
.getProperty(key)
|
||||
}
|
||||
|
||||
@@ -20,11 +20,6 @@
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<!-- Injected from local.properties (glitchtip.dsn); an empty DSN disables the SDK. -->
|
||||
<meta-data android:name="io.sentry.dsn" android:value="${glitchtipDsn}" />
|
||||
<meta-data android:name="io.sentry.traces.sample-rate" android:value="0.01" />
|
||||
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
@@ -10,10 +10,11 @@ class ChomBevApp : Application() {
|
||||
if (isDebuggable()) {
|
||||
enableStrictMode()
|
||||
}
|
||||
|
||||
SentryHelper.initializeSentry()
|
||||
}
|
||||
|
||||
private fun isDebuggable(): Boolean =
|
||||
applicationInfo.flags and ApplicationInfo.FLAG_DEBUGGABLE != 0
|
||||
private fun isDebuggable(): Boolean = applicationInfo.flags and ApplicationInfo.FLAG_DEBUGGABLE != 0
|
||||
|
||||
/**
|
||||
* Enables StrictMode for debug builds only. All violations are logged
|
||||
|
||||
Reference in New Issue
Block a user