Add Sentry to MapLibreAndroidTestApp (#3716)

Co-authored-by: Bart Louwers <bart@emeel.net>
Co-authored-by: Bart Louwers <bart.louwers@gmail.com>
This commit is contained in:
Adrian Cojocaru
2025-08-14 16:49:02 +03:00
committed by GitHub
parent 213d1c6187
commit 8908056d5f
7 changed files with 288 additions and 76 deletions

View File

@@ -9,7 +9,6 @@ plugins {
id("maplibre.gradle-lint")
}
fun obtainTestBuildType(): String {
return if (project.hasProperty("testBuildType")) {
project.properties["testBuildType"] as String
@@ -31,6 +30,7 @@ android {
versionName = "6.0.1"
testInstrumentationRunner = "org.maplibre.android.InstrumentationRunner"
multiDexEnabled = true
manifestPlaceholders["SENTRY_DSN"] = ""
}
nativeBuild(listOf("example-custom-layer"))
@@ -47,6 +47,14 @@ android {
isMinifyEnabled = false
isShrinkResources = false
proguardFiles(getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro")
packaging {
jniLibs {
keepDebugSymbols += "**/*.so"
}
}
buildConfigField("String", "SENTRY_DSN", "\"" + (System.getenv("SENTRY_DSN") ?: "") + "\"")
manifestPlaceholders["SENTRY_DSN"] = System.getenv("SENTRY_DSN") ?: ""
}
getByName("release") {
isMinifyEnabled = true
@@ -54,6 +62,9 @@ android {
proguardFiles(getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro")
testProguardFiles("test-proguard-rules.pro")
signingConfig = signingConfigs.getByName("debug")
buildConfigField("String", "SENTRY_DSN", "\"" + (System.getenv("SENTRY_DSN") ?: "") + "\"")
manifestPlaceholders["SENTRY_DSN"] = System.getenv("SENTRY_DSN") ?: ""
}
}
@@ -119,3 +130,5 @@ dependencies {
androidTestImplementation(libs.androidxTestCoreKtx)
androidTestImplementation(libs.kotlinxCoroutinesTest)
}
apply<SentryConditionalPlugin>()

View File

@@ -1283,6 +1283,68 @@
android:name="android.support.PARENT_ACTIVITY"
android:value=".activity.FeatureOverviewActivity" />
</activity>
<!-- Sentry setup -->
<!-- Required: set your sentry.io project identifier (DSN) -->
<meta-data
android:name="io.sentry.dsn"
android:value="${SENTRY_DSN}"
/>
<!-- Add data like request headers, user ip address and device name, see https://docs.sentry.io/platforms/android/data-management/data-collected/ for more info -->
<meta-data
android:name="io.sentry.send-default-pii"
android:value="true"
/>
<!-- enable automatic breadcrumbs for user interactions (clicks, swipes, scrolls) -->
<meta-data
android:name="io.sentry.traces.user-interaction.enable"
android:value="true"
/>
<!-- enable screenshot for crashes -->
<meta-data
android:name="io.sentry.attach-screenshot"
android:value="true"
/>
<!-- enable view hierarchy for crashes -->
<meta-data
android:name="io.sentry.attach-view-hierarchy"
android:value="true"
/>
<!-- enable the performance API by setting a sample-rate, adjust in production env -->
<meta-data
android:name="io.sentry.traces.sample-rate"
android:value="1.0"
/>
<!-- Enable UI profiling, adjust in production env. This is evaluated only once per session -->
<meta-data
android:name="io.sentry.traces.profiling.session-sample-rate"
android:value="1.0"
/>
<!-- Set profiling mode. For more info see https://docs.sentry.io/platforms/android/profiling/#enabling-ui-profiling -->
<meta-data
android:name="io.sentry.traces.profiling.lifecycle"
android:value="trace"
/>
<!-- Enable profiling on app start. The app start profile will be stopped automatically when the app start root span finishes -->
<meta-data
android:name="io.sentry.traces.profiling.start-on-app-start"
android:value="true"
/>
<!-- record session replays for 100% of errors and 10% of sessions -->
<meta-data
android:name="io.sentry.session-replay.on-error-sample-rate"
android:value="1.0"
/>
<meta-data
android:name="io.sentry.session-replay.session-sample-rate"
android:value="0.1"
/>
</application>
</manifest>