A Gradle plugin that generated UUIDs, adds it to your AndroidManifest.xml
and uploads the UUID together with the generated mapping file to Sentry.
Add the plugin to the Android application build.gradle[.kts] file and configure it:
plugins {
id "com.ioki.sentry.proguard" version "[CURRENT_VERSION]"
}
sentryProguard {
organization.set("SENTRY_ORG")
project.set("SENTRY_PROJECT")
authToken.set("SENTRY_AUTH_TOKEN")
noUpload.set(false)
}The sentryProguard.noUpload function is useful for development purposes.
Normally, you don't want to upload the mapping file to Sentry while creating a minified version on developer machines.
Instead, you just want to upload the mapping file on your CI. In case you do a "real release".
So something like the following can be implemented:
def sentryUpload = hasProperty("SENTRY_UPLOAD")
sentryProguard {
noUpload.set(!sentryUpload)
}By default, you don't set the Gradle property. In this case the plugin won't upload the mapping files. On your CI, however, you set the property and therefore the mapping file will be uploaded.
If you run "any" task on a minifiedEnabled build type, the Plugin will:
- Generate a
UUID - Place a
<meta-data>attribute to theAndroidManifest.xml(see also this sentry-android-gradle-plugin code) - Create a task to download the Sentry CLI
- Create a task for each build variant that uploads the
UUIDalong with themappingfile via the Sentry CLI - Hook the created tasks into the task graph (adds a
finalizedBy(uploadUuidTask)to theminify[BuildVariant]WithR8task)
To run the tests you either have to provide the ANDROID_HOME environment variable (pointing to the Android SDK path)
or adding a local.properties file to the androidTestProject:
// on macOS mostly at: ~/Library/Android/sdk
sdk.dir=[path/to/the/android/sdk]
By default, each merge to the main branch will create a new SNAPSHOT release.
If you want to use the latest and greatest use the SNAPSHOT version of the plugin.
But please be aware that they might contain bugs or behaviour changes.
To use the SNAPSHOT version you have to include the sonatype snapshot repository to your settings.gradle[.kts]
pluginManagement {
repositories {
maven(url = "https://central.sonatype.com/repository/maven-snapshots")
}
}- Checkout
mainbranch - Update the
versioninbuild.gradle.kts - Update the version for the
consuming of plugin marker publication via mavenLocal workstest - Commit
git commit -m "Prepare next relaese"
- Tag the version with the same version and push it to origin
git tag [VERSION]git push origin [VERSION]
- Update the version to the "next minor version" (including
-SNAPSHOT) - Update the version for the
consuming of plugin marker publication via mavenLocal workstest - Commit and push
- Create a new GitHub release