🚀 A Gradle plugin that generates UUIDs
, adds them to your AndroidManifest.xml
, and uploads the UUID
along with the generated mapping
file to Sentry.
Add the plugin to your 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 during a "real release." You can implement it like this:
def sentryUpload = hasProperty("SENTRY_UPLOAD")
sentryProguard {
noUpload.set(!sentryUpload)
}
By default, if you don’t set the Gradle property, the plugin won’t upload the mapping files. On your CI, however, you set the property, and therefore the mapping file will be uploaded.
When you run "any" task on a minifiedEnabled
build type, the Plugin will:
- Generate a
UUID
📦 - Place a
<meta-data>
attribute in 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
UUID
along with themapping
file via the Sentry CLI - Hook the created tasks into the task graph (adds a
finalizedBy(uploadUuidTask)
to theminify[BuildVariant]WithR8
task)
To run the tests, you either have to provide the ANDROID_HOME
environment variable (pointing to the Android SDK path) or add 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. Please be aware that they might contain bugs or behavior changes.
To use the SNAPSHOT version, include the Sonatype snapshot repository in your settings.gradle[.kts]
:
pluginManagement {
repositories {
maven(url = "https://s01.oss.sonatype.org/content/repositories/snapshots/")
}
}
- Checkout the
main
branch - Update the
version
inbuild.gradle.kts
- Update the version for the
consuming of plugin marker publication via mavenLocal works
test - Commit
git commit -m "Prepare next release"
- 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 works
test - Commit and push
- Create a new GitHub release