enhance(android): add crash report using sentry.io

This commit is contained in:
Andelf
2024-01-03 21:34:24 +08:00
parent 8390c957f0
commit 9030dd362c
3 changed files with 35 additions and 1 deletions

3
android/.gitignore vendored
View File

@@ -94,3 +94,6 @@ capacitor-cordova-android-plugins
# Copied web assets
app/src/main/assets/public
# Sentry Config File
sentry.properties

View File

@@ -1,3 +1,8 @@
plugins {
id 'io.sentry.android.gradle' version '4.1.1'
}
apply plugin: 'com.android.application'
android {
@@ -15,6 +20,7 @@ android {
// Default: https://android.googlesource.com/platform/frameworks/base/+/282e181b58cf72b6ca770dc7ca5f91f135444502/tools/aapt/AaptAssets.cpp#61
ignoreAssetsPattern '!.svn:!.git:!.ds_store:!*.scc:.*:!CVS:!thumbs.db:!picasa.ini:!*~'
}
manifestPlaceholders = [LOGSEQ_SENTRY_DSN: "$System.env.LOGSEQ_SENTRY_DSN"]
}
buildTypes {
release {
@@ -53,3 +59,13 @@ try {
} catch(Exception e) {
logger.warn("google-services.json not found, google-services plugin not applied. Push Notifications won't work")
}
sentry {
org = "logseq"
projectName = "logseq"
// this will upload your source code to Sentry to show it as part of the stack traces
// disable if you don't want to expose your sources
includeSourceContext = false
}

View File

@@ -60,5 +60,20 @@
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/file_paths" />
</provider>
</application>
<!-- Required: set your sentry.io project identifier (DSN) -->
<meta-data android:name="io.sentry.dsn" android:value="${LOGSEQ_SENTRY_DSN}" />
<!-- 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 (could contain sensitive/PII data) -->
<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 profiling when starting transactions, adjust in production env -->
<meta-data android:name="io.sentry.traces.profiling.sample-rate" android:value="1.0" />
</application>
</manifest>