From f36db0e27974d533b0e014482458baf059e46b92 Mon Sep 17 00:00:00 2001 From: Brandon McAnsh Date: Sun, 30 Aug 2026 15:58:31 -0400 Subject: [PATCH] fix(bugsnag): give the app and the uploaded mapping the same build UUID MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bugsnag joins an uploaded ProGuard mapping to an incoming event on build UUID, falling back to applicationId + versionName + versionCode. Neither side was supplying one, so matching rested entirely on the version numbers. The app never reported a build UUID. com.bugsnag.gradle 1.2.0 emits it as a string resource, but bugsnag-android 6.27 reads com.bugsnag.android.BUILD_UUID only as manifest meta-data (ManifestConfigLoader) — nothing in the AAR looks the resource up. Being unreferenced, the resource is then dropped by resource shrinking, per mapping/release/resources.txt: string:com_bugsnag_android_BUILD_UUID:2131820793 is not reachable. The upload omitted it as well: registerProguardMappingTask sets build-uuid only when the bugsnag DSL supplies buildUuid or buildUuidGenerator, and this project supplied neither. Use the commit SHA for both. The release workflow builds the bundle and runs bugsnagUploadReleaseProguardMapping in the same job on the same checkout, so the two Gradle invocations resolve the same HEAD. Carrying the app's copy as manifest meta-data rather than a resource also keeps it out of the shrinker's reach. --- apps/flipcash/app/build.gradle.kts | 13 +++++++++++++ apps/flipcash/app/src/main/AndroidManifest.xml | 10 ++++++++++ 2 files changed, 23 insertions(+) diff --git a/apps/flipcash/app/build.gradle.kts b/apps/flipcash/app/build.gradle.kts index bcdc315f7..502200040 100644 --- a/apps/flipcash/app/build.gradle.kts +++ b/apps/flipcash/app/build.gradle.kts @@ -26,6 +26,17 @@ fun gitVersionCode(): Int { return result.toInt().also { println("VersionCode $it") } } +// Bugsnag joins an uploaded mapping file to an incoming event on build UUID, falling back +// to applicationId + versionName + versionCode. Neither side was supplying one: the Gradle +// plugin emits the UUID as a string resource that bugsnag-android never reads (it looks for +// manifest meta-data only) and that resource shrinking strips anyway, and the mapping upload +// omits `build-uuid` unless the `bugsnag` block below sets it. The commit SHA gives both +// sides the same value — the app build and the upload task run against the same HEAD in the +// release workflow — and going through the manifest keeps it out of the shrinker's reach. +val bugsnagBuildId: String = providers.exec { + commandLine("git", "rev-parse", "HEAD") +}.standardOutput.asText.get().trim() + val contributorsSigningConfig = ContributorsSignatory(rootDir) val appNamespace = "${Gradle.flipcashNamespace}.app.android" @@ -50,6 +61,7 @@ android { buildConfigField("Boolean", "NOTIFY_ERRORS", "false") manifestPlaceholders["BUGSNAG_API_KEY"] = tryReadProperty(rootProject.rootDir, "BUGSNAG_API_KEY") + manifestPlaceholders["BUGSNAG_BUILD_UUID"] = bugsnagBuildId } signingConfigs { @@ -127,6 +139,7 @@ bugsnag { variants { release { autoCreateBuild = true + buildUuid = bugsnagBuildId } debug { enabled = false diff --git a/apps/flipcash/app/src/main/AndroidManifest.xml b/apps/flipcash/app/src/main/AndroidManifest.xml index abee5b5d4..f98fb739d 100644 --- a/apps/flipcash/app/src/main/AndroidManifest.xml +++ b/apps/flipcash/app/src/main/AndroidManifest.xml @@ -76,6 +76,16 @@ android:name="com.bugsnag.android.API_KEY" android:value="${BUGSNAG_API_KEY}" /> + + +