Sentry mapping file upload task is missing from version 4.3.0
Gradle Version
8.7
AGP Version
8.4.0
Code Minifier/Optimizer
Dexguard
Version
4.6.0
Sentry SDK Version
7.9.0
Steps to Reproduce
We are using https://github.com/Triple-T/gradle-play-publisher to generate and upload our app bundles to the distribution channel. We recently noticed that the sentry mapping file is missing on further investigation we found out that issue started to happen after we updated to 4.4.0 and 4.6.0 also have this issue.
After enabling debug for sentry configuration we see following logs.
DEBUG: UncaughtExceptionHandlerIntegration removed.
INFO: Closing SentryClient.
DEBUG: Serializing object: {"transaction":"gradle build Android","start_timestamp":1716308381.189080,"timestamp":1716310318.748254,"spans":[{"start_timestamp":1716308433.217697,"timestamp":1716308433.226593,"trace_id":"0f5a8210c6414747bacffe1a55546e57","span_id":"99ecb1cae33b4d0b","parent_span_id":"fe3c305b2ff64857","op":"3379458255_SentryGenerateIntegrationListTask_Decorated","origin":"manual","data":{}},{"start_timestamp":1716308585.934229,"timestamp":1716308585.934844,"trace_id":"0f5a8210c6414747bacffe1a55546e57","span_id":"2a8f226dc04047ca","parent_span_id":"fe3c305b2ff64857","op":"3379458255_SentryExternalDependenciesReportTaskV2_Decorated","origin":"manual","data":{}},{"start_timestamp":1716308623.873808,"timestamp":1716308623.875345,"trace_id":"0f5a8210c6414747bacffe1a55546e57","span_id":"9d28800a82044295","parent_span_id":"fe3c305b2ff64857","op":"3379458255_SentryGenerateProguardUuidTask_Decorated","origin":"manual","data":{}},{"start_timestamp":1716308624.150534,"timestamp":1716308624.152972,"trace_id":"0f5a8210c6414747bacffe1a55546e57","span_id":"ac2bafe159e249b3","parent_span_id":"fe3c305b2ff64857","op":"3379458255_InjectSentryMetaPropertiesIntoAssetsTask_Decorated","origin":"manual","data":{}}],"type":"transaction","transaction_info":{"source":"custom"},"event_id":"bbff1d0034e34bfc8af0cc0f29b46f10","contexts":{"runtime":{"name":"Private Build","version":"17.0.10"},"trace":{"trace_id":"0f5a8210c6414747bacffe1a55546e57","span_id":"fe3c305b2ff64857","op":"build","origin":"manual"}},"sdk":{"name":"sentry.java","version":"6.31.0","packages":[{"name":"maven:io.sentry:sentry","version":"6.31.0"}],"integrations":["UncaughtExceptionHandler","ShutdownHook"]},"tags":{"AGP_VERSION":"8.4.0","includeNativeSources":"false","ignoredBuildTypes_set":"true","tracing_enabled":"true","includeSourceContext":"false","autoInstallation_enabled":"true","uploadNativeSymbols":"false","autoUpload":"true","includeDependenciesReport":"true","SDK_VERSION":"7.9.0","dexguardEnabled":"true","tracing_features":"[FILE_IO, OKHTTP, COMPOSE]","tracing_logcat_minLevel":"WARNING","tracing_debug":"false","tracing_forceInstrumentDependencies":"false","SENTRY_CLI_VERSION":"2.31.2","ignoredVariants_set":"false","debug":"true","GRADLE_VERSION":"8.7","includeProguardMapping":"true","additionalSourceDirsForSourceContext_set":"false","BUILD_SYSTEM":"gradle","tracing_logcat_enabled":"true","autoInstallation_sentryVersion":"7.9.0","autoUploadNativeSymbols":"true","autoUploadProguardMapping":"true","ignoredFlavors_set":"false","step":"3379458255_InjectSentryMetaPropertiesIntoAssetsTask_Decorated"},"release":"4.6.0","environment":"Android","platform":"java","user":{"id":"delivery-hero-pm"},"server_name":"prd-linux-use5b-7c56872f-8634-4964-9848-b27a95f4fd03.c.bitrise-workers.internal"}
DEBUG: Envelope sent successfully.
DEBUG: Envelope flushed
DEBUG: Serializing object: {"sid":"014684e5-6d34-4eff-8b1c-6e2ff4c81b19","started":"2024-05-21T16:19:41.188Z","status":"exited","seq":1716310318748,"errors":0,"duration":1937.56,"timestamp":"2024-05-21T16:51:58.748Z","attrs":{"release":"4.6.0","environment":"Android"}}
DEBUG: Envelope sent successfully.
DEBUG: Envelope flushed
DEBUG: Shutting down
Expected Result
The mapping file should be uploaded to sentry
Actual Result
The mapping file upload task is missing hence, the mapping file is not uploaded to sentryThe mapping
┆Issue is synchronized with this Jira Improvement by Unito
hi @ZeeshanShabbir, thanks for the report! Presumably you're using DexGuard, right? I think the issue is most likely a consequence of this PR.
We'll probably need a bit more logs from you, e.g. what tasks have run in the build. You could also send them internally via your assigned solutions engineer, or directly to me at [email protected].
Thank you!
Hey @stefanosiano & @romtsn - I've added comments to the internal Jira ticket
@Angelodaniel thanks, we'll discuss in our sync today
a similar problem was reported over Discord: https://discord.com/channels/621778831602221064/1245430650635288729/1245430650635288729
seems like when the play-publisher-plugin task is executed (e.g. publish${Variant}Bundle), we only execute generateSentryProguardUuid but not the upload task
A quick look at this issue confirms that our sentry upload task is not being executed.
Right now we wire up the bundle task roughly this way:
val bundleTask = project.findTaskByName("bundleRelease")
bundleTask?.configure { it.finalizedBy(uploadProguardMappingsToSentryTask) }
It looks like the play publisher plugin doesn't hook into bundleRelease, but rather depends on signReleaseBundle:
publishBundle Task Tree
:app:publishBundle
\--- :app:publishReleaseBundle
+--- :app:generateReleasePlayResources
\--- :app:signReleaseBundle
+--- :app:packageReleaseBundle
| +--- :app:buildReleasePreBundle
| | +--- :app:bundleReleaseResources
| | | +--- :app:mapReleaseSourceSetPaths
| | | | +--- :app:generateReleaseResValues
| | | | | \--- :app:preReleaseBuild
| | | | | \--- :app:preBuild
| | | | \--- :app:preReleaseBuild *
| | | +--- :app:mergeReleaseResources
| | | | +--- :app:generateReleaseResValues *
| | | | +--- :app:generateReleaseResources
| | | | | +--- :app:generateReleaseResValues *
| | | | | \--- :app:preReleaseBuild *
| | | | \--- :app:preReleaseBuild *
| | | +--- :app:preReleaseBuild *
| | | +--- :app:processApplicationManifestReleaseForBundle
| | | | +--- :app:preReleaseBuild *
| | | | \--- :app:processReleaseManifest
| | | | +--- :app:createReleaseCompatibleScreenManifests
| | | | | \--- :app:preReleaseBuild *
| | | | +--- :app:preReleaseBuild *
| | | | \--- :app:releaseSentryGenerateIntegrationListTask
| | | | \--- :app:processReleaseMainManifest
| | | | +--- :app:extractDeepLinksRelease
| | | | | +--- :app:generateReleaseResValues *
| | | | | \--- :app:preReleaseBuild *
| | | | \--- :app:preReleaseBuild *
| | | \--- :app:processReleaseResources
| | | +--- :app:checkReleaseAarMetadata
| | | | \--- :app:preReleaseBuild *
| | | +--- :app:mapReleaseSourceSetPaths *
| | | +--- :app:mergeReleaseResources *
| | | +--- :app:parseReleaseLocalResources
| | | | +--- :app:packageReleaseResources
| | | | | +--- :app:generateReleaseResValues *
| | | | | +--- :app:generateReleaseResources *
| | | | | \--- :app:preReleaseBuild *
| | | | \--- :app:preReleaseBuild *
| | | +--- :app:preReleaseBuild *
| | | +--- :app:processReleaseManifest *
| | | \--- :app:processReleaseManifestForPackage
| | | +--- :app:preReleaseBuild *
| | | \--- :app:processReleaseManifest *
| | +--- :app:extractReleaseVersionControlInfo
| | | \--- :app:preReleaseBuild *
| | +--- :app:injectSentryDebugMetaPropertiesIntoAssetsRelease
| | | +--- :app:generateSentryProguardUuidRelease
| | | \--- :app:mergeReleaseAssets
| | | +--- :app:collectExternalReleaseDependenciesForSentry
| | | +--- :app:compileReleaseShaders
| | | | +--- :app:mergeReleaseShaders
| | | | | \--- :app:preReleaseBuild *
| | | | \--- :app:preReleaseBuild *
| | | +--- :app:generateReleaseAssets
| | | | \--- :app:compileReleaseShaders *
| | | \--- :app:preReleaseBuild *
| | +--- :app:minifyReleaseWithR8
| | | +--- :app:checkReleaseDuplicateClasses
| | | | \--- :app:preReleaseBuild *
| | | +--- :app:expandReleaseArtProfileWildcards
| | | | +--- :app:mergeReleaseArtProfile
| | | | | \--- :app:preReleaseBuild *
| | | | +--- :app:preReleaseBuild *
| | | | \--- :app:transformReleaseClassesWithAsm
| | | | +--- :app:buildKotlinToolingMetadata
| | | | +--- :app:compileReleaseJavaWithJavac
| | | | | +--- :app:compileReleaseKotlin
| | | | | | +--- :app:checkKotlinGradlePluginConfigurationErrors
| | | | | | +--- :app:dataBindingGenBaseClassesRelease
| | | | | | | +--- :app:dataBindingMergeDependencyArtifactsRelease
| | | | | | | | \--- :app:preReleaseBuild *
| | | | | | | +--- :app:mergeReleaseResources *
| | | | | | | +--- :app:parseReleaseLocalResources *
| | | | | | | \--- :app:preReleaseBuild *
| | | | | | +--- :app:dataBindingTriggerRelease
| | | | | | | \--- :app:preReleaseBuild *
| | | | | | +--- :app:kspReleaseKotlin
| | | | | | | +--- :app:checkKotlinGradlePluginConfigurationErrors *
| | | | | | | +--- :app:dataBindingGenBaseClassesRelease *
| | | | | | | +--- :app:dataBindingTriggerRelease *
| | | | | | | \--- :app:processReleaseResources *
| | | | | | \--- :app:processReleaseResources *
| | | | | +--- :app:dataBindingGenBaseClassesRelease *
| | | | | +--- :app:dataBindingMergeDependencyArtifactsRelease *
| | | | | +--- :app:dataBindingTriggerRelease *
| | | | | +--- :app:javaPreCompileRelease
| | | | | | \--- :app:preReleaseBuild *
| | | | | +--- :app:kspReleaseKotlin *
| | | | | +--- :app:mergeReleaseResources *
| | | | | +--- :app:parseReleaseLocalResources *
| | | | | +--- :app:preReleaseBuild *
| | | | | \--- :app:processReleaseResources *
| | | | +--- :app:compileReleaseKotlin *
| | | | +--- :app:kspReleaseKotlin *
| | | | +--- :app:preReleaseBuild *
| | | | \--- :app:processReleaseResources *
| | | +--- :app:extractProguardFiles
| | | | \--- :app:preBuild *
| | | +--- :app:mergeReleaseGeneratedProguardFiles
| | | | +--- :app:preReleaseBuild *
| | | | \--- :app:transformReleaseClassesWithAsm *
| | | +--- :app:mergeReleaseJavaResource
| | | | +--- :app:preReleaseBuild *
| | | | \--- :app:processReleaseJavaRes
| | | | +--- :app:buildKotlinToolingMetadata *
| | | | +--- :app:compileReleaseJavaWithJavac *
| | | | +--- :app:compileReleaseKotlin *
| | | | +--- :app:kspReleaseKotlin *
| | | | \--- :app:preReleaseBuild *
| | | +--- :app:preReleaseBuild *
| | | +--- :app:processReleaseResources *
| | | \--- :app:transformReleaseClassesWithAsm *
| | +--- :app:preReleaseBuild *
| | +--- :app:stripReleaseDebugSymbols
| | | +--- :app:mergeReleaseNativeLibs
| | | | +--- :app:mergeReleaseJniLibFolders
| | | | | \--- :app:preReleaseBuild *
| | | | \--- :app:preReleaseBuild *
| | | \--- :app:preReleaseBuild *
| | \--- :app:writeReleaseAppMetadata
| | \--- :app:preReleaseBuild *
| +--- :app:compileReleaseArtProfile
| | +--- :app:minifyReleaseWithR8 *
| | \--- :app:preReleaseBuild *
| +--- :app:configureReleaseDependencies
| | +--- :app:collectReleaseDependencies
| | | \--- :app:preReleaseBuild *
| | \--- :app:preReleaseBuild *
| +--- :app:extractReleaseNativeSymbolTables
| | +--- :app:mergeReleaseNativeLibs *
| | +--- :app:preReleaseBuild *
| | \--- :app:stripReleaseDebugSymbols *
| +--- :app:minifyReleaseWithR8 *
| +--- :app:parseReleaseIntegrityConfig
| | \--- :app:preReleaseBuild *
| +--- :app:preReleaseBuild *
| \--- :app:writeReleaseAppMetadata *
+--- :app:preReleaseBuild *
\--- :app:validateSigningRelease
\--- :app:preReleaseBuild *
For reference here's the current taskTree of the bundleRelease task:
bundleRelease Task Tree
:app:bundleRelease
\--- :app:signReleaseBundle
+--- :app:packageReleaseBundle
| +--- :app:buildReleasePreBundle
| | +--- :app:bundleReleaseResources
| | | +--- :app:mapReleaseSourceSetPaths
| | | | +--- :app:generateReleaseResValues
| | | | | \--- :app:preReleaseBuild
| | | | | \--- :app:preBuild
| | | | \--- :app:preReleaseBuild *
| | | +--- :app:mergeReleaseResources
| | | | +--- :app:generateReleaseResValues *
| | | | +--- :app:generateReleaseResources
| | | | | +--- :app:generateReleaseResValues *
| | | | | \--- :app:preReleaseBuild *
| | | | \--- :app:preReleaseBuild *
| | | +--- :app:preReleaseBuild *
| | | +--- :app:processApplicationManifestReleaseForBundle
| | | | +--- :app:preReleaseBuild *
| | | | \--- :app:processReleaseManifest
| | | | +--- :app:createReleaseCompatibleScreenManifests
| | | | | \--- :app:preReleaseBuild *
| | | | +--- :app:preReleaseBuild *
| | | | \--- :app:releaseSentryGenerateIntegrationListTask
| | | | \--- :app:processReleaseMainManifest
| | | | +--- :app:extractDeepLinksRelease
| | | | | +--- :app:generateReleaseResValues *
| | | | | \--- :app:preReleaseBuild *
| | | | \--- :app:preReleaseBuild *
| | | \--- :app:processReleaseResources
| | | +--- :app:checkReleaseAarMetadata
| | | | \--- :app:preReleaseBuild *
| | | +--- :app:mapReleaseSourceSetPaths *
| | | +--- :app:mergeReleaseResources *
| | | +--- :app:parseReleaseLocalResources
| | | | +--- :app:packageReleaseResources
| | | | | +--- :app:generateReleaseResValues *
| | | | | +--- :app:generateReleaseResources *
| | | | | \--- :app:preReleaseBuild *
| | | | \--- :app:preReleaseBuild *
| | | +--- :app:preReleaseBuild *
| | | +--- :app:processReleaseManifest *
| | | \--- :app:processReleaseManifestForPackage
| | | +--- :app:preReleaseBuild *
| | | \--- :app:processReleaseManifest *
| | +--- :app:extractReleaseVersionControlInfo
| | | \--- :app:preReleaseBuild *
| | +--- :app:injectSentryDebugMetaPropertiesIntoAssetsRelease
| | | +--- :app:generateSentryProguardUuidRelease
| | | \--- :app:mergeReleaseAssets
| | | +--- :app:collectExternalReleaseDependenciesForSentry
| | | +--- :app:compileReleaseShaders
| | | | +--- :app:mergeReleaseShaders
| | | | | \--- :app:preReleaseBuild *
| | | | \--- :app:preReleaseBuild *
| | | +--- :app:generateReleaseAssets
| | | | \--- :app:compileReleaseShaders *
| | | \--- :app:preReleaseBuild *
| | +--- :app:minifyReleaseWithR8
| | | +--- :app:checkReleaseDuplicateClasses
| | | | \--- :app:preReleaseBuild *
| | | +--- :app:expandReleaseArtProfileWildcards
| | | | +--- :app:mergeReleaseArtProfile
| | | | | \--- :app:preReleaseBuild *
| | | | +--- :app:preReleaseBuild *
| | | | \--- :app:transformReleaseClassesWithAsm
| | | | +--- :app:buildKotlinToolingMetadata
| | | | +--- :app:compileReleaseJavaWithJavac
| | | | | +--- :app:compileReleaseKotlin
| | | | | | +--- :app:checkKotlinGradlePluginConfigurationErrors
| | | | | | +--- :app:dataBindingGenBaseClassesRelease
| | | | | | | +--- :app:dataBindingMergeDependencyArtifactsRelease
| | | | | | | | \--- :app:preReleaseBuild *
| | | | | | | +--- :app:mergeReleaseResources *
| | | | | | | +--- :app:parseReleaseLocalResources *
| | | | | | | \--- :app:preReleaseBuild *
| | | | | | +--- :app:dataBindingTriggerRelease
| | | | | | | \--- :app:preReleaseBuild *
| | | | | | +--- :app:kspReleaseKotlin
| | | | | | | +--- :app:checkKotlinGradlePluginConfigurationErrors *
| | | | | | | +--- :app:dataBindingGenBaseClassesRelease *
| | | | | | | +--- :app:dataBindingTriggerRelease *
| | | | | | | \--- :app:processReleaseResources *
| | | | | | \--- :app:processReleaseResources *
| | | | | +--- :app:dataBindingGenBaseClassesRelease *
| | | | | +--- :app:dataBindingMergeDependencyArtifactsRelease *
| | | | | +--- :app:dataBindingTriggerRelease *
| | | | | +--- :app:javaPreCompileRelease
| | | | | | \--- :app:preReleaseBuild *
| | | | | +--- :app:kspReleaseKotlin *
| | | | | +--- :app:mergeReleaseResources *
| | | | | +--- :app:parseReleaseLocalResources *
| | | | | +--- :app:preReleaseBuild *
| | | | | \--- :app:processReleaseResources *
| | | | +--- :app:compileReleaseKotlin *
| | | | +--- :app:kspReleaseKotlin *
| | | | +--- :app:preReleaseBuild *
| | | | \--- :app:processReleaseResources *
| | | +--- :app:extractProguardFiles
| | | | \--- :app:preBuild *
| | | +--- :app:mergeReleaseGeneratedProguardFiles
| | | | +--- :app:preReleaseBuild *
| | | | \--- :app:transformReleaseClassesWithAsm *
| | | +--- :app:mergeReleaseJavaResource
| | | | +--- :app:preReleaseBuild *
| | | | \--- :app:processReleaseJavaRes
| | | | +--- :app:buildKotlinToolingMetadata *
| | | | +--- :app:compileReleaseJavaWithJavac *
| | | | +--- :app:compileReleaseKotlin *
| | | | +--- :app:kspReleaseKotlin *
| | | | \--- :app:preReleaseBuild *
| | | +--- :app:preReleaseBuild *
| | | +--- :app:processReleaseResources *
| | | \--- :app:transformReleaseClassesWithAsm *
| | +--- :app:preReleaseBuild *
| | +--- :app:stripReleaseDebugSymbols
| | | +--- :app:mergeReleaseNativeLibs
| | | | +--- :app:mergeReleaseJniLibFolders
| | | | | \--- :app:preReleaseBuild *
| | | | \--- :app:preReleaseBuild *
| | | \--- :app:preReleaseBuild *
| | \--- :app:writeReleaseAppMetadata
| | \--- :app:preReleaseBuild *
| +--- :app:compileReleaseArtProfile
| | +--- :app:minifyReleaseWithR8 *
| | \--- :app:preReleaseBuild *
| +--- :app:configureReleaseDependencies
| | +--- :app:collectReleaseDependencies
| | | \--- :app:preReleaseBuild *
| | \--- :app:preReleaseBuild *
| +--- :app:extractReleaseNativeSymbolTables
| | +--- :app:mergeReleaseNativeLibs *
| | +--- :app:preReleaseBuild *
| | \--- :app:stripReleaseDebugSymbols *
| +--- :app:minifyReleaseWithR8 *
| +--- :app:parseReleaseIntegrityConfig
| | \--- :app:preReleaseBuild *
| +--- :app:preReleaseBuild *
| \--- :app:writeReleaseAppMetadata *
+--- :app:preReleaseBuild *
\--- :app:validateSigningRelease
\--- :app:preReleaseBuild *
@romtsn I see two routes we could take:
- just like the play publisher plugin, hook into
signReleaseBundle. This could have some side effects, maybe when building bundles without a signing config. I guess this needs to be tested. - Hook into
publishReleaseBundletask
publishReleaseBundle is coming from the plugin, right?
publishReleaseBundleis coming from the plugin, right?
Yes, exactly! Which makes this approach a bit more fragile.
https://github.com/Triple-T/gradle-play-publisher/blob/57461976b2322e367d8cc0f62fd202b71dda8013/play/plugin/src/main/kotlin/com/github/triplet/gradle/play/PlayPublisherPlugin.kt#L689-L713
ok the plugin handles crashlytics and bugsnag, but not sentry 🫠
Quick update: We're aiming to get this fixed within https://github.com/Triple-T/gradle-play-publisher. See the issue and PR for more details.
Another update: v3.10.0 of the play-publisher plugin has been released, please give it a try and let us know if the mapping file upload works as expected.
Closing this for now. If you're still facing this issue, please leave a comment and we'll re-open.
We are still facing this issue that sentry mapping files aren’t uploaded still. We are using sentry android 7.11.0 and plugin version is 4.9.0. We are using the 3.10.1 version of Gradle Publisher Plugin
DEBUG: UncaughtExceptionHandlerIntegration removed. INFO: Closing SentryClient. DEBUG: Serializing object: {"transaction":"gradle build Android","start_timestamp":[REDACTED]720440084.2[REDACTED]3[REDACTED]64,"timestamp":[REDACTED]720442099.9776[REDACTED]4,"spans":[{"start_timestamp":[REDACTED]720440372.9893[REDACTED]2,"timestamp":[REDACTED]720440373.06[REDACTED]558,"trace_id":"0[REDACTED]fea[REDACTED]79a58e488587b55fa79aa2775b","span_id":"3a826a[REDACTED]bc9994[REDACTED]2f","parent_span_id":"f079dc0a[REDACTED]9cb40cd","op":"3379458255_SentryGenerateIntegrationListTask_Decorated","origin":"manual","data":{"thread.name":"Execution worker Thread 2","thread.id":"529"}},{"start_timestamp":[REDACTED]72044042[REDACTED].768049,"timestamp":[REDACTED]72044042[REDACTED].768660,"trace_id":"0[REDACTED]fea[REDACTED]79a58e488587b55fa79aa2775b","span_id":"8988d4bd86b34c99","parent_span_id":"f079dc0a[REDACTED]9cb40cd","op":"3379458255_SentryExternalDependenciesReportTaskV2_Decorated","origin":"manual","data":{"thread.name":"Execution worker Thread 5","thread.id":"532"}},{"start_timestamp":[REDACTED]720440480.774309,"timestamp":[REDACTED]720440480.775428,"trace_id":"0[REDACTED]fea[REDACTED]79a58e488587b55fa79aa2775b","span_id":"a77d[REDACTED]295cf04c3c","parent_span_id":"f079dc0a[REDACTED]9cb40cd","op":"3379458255_SentryGenerateProguardUuidTask_Decorated","origin":"manual","data":{"thread.name":"included builds","thread.id":"527"}},{"start_timestamp":[REDACTED]720440480.777584,"timestamp":[REDACTED]720440480.78[REDACTED]698,"trace_id":"0[REDACTED]fea[REDACTED]79a58e488587b55fa79aa2775b","span_id":"978682[REDACTED]fdafa492b","parent_span_id":"f079dc0a[REDACTED]9cb40cd","op":"3379458255_InjectSentryMetaPropertiesIntoAssetsTask_Decorated","origin":"manual","data":{"thread.name":"included builds","thread.id":"527"}}],"type":"transaction","transaction_info":{"source":"custom"},"event_id":"67539f0b0ec44e8f9724967[REDACTED]f2ac5d89","contexts":{"runtime":{"name":"Private Build","version":"2[REDACTED].0.2"},"trace":{"trace_id":"0[REDACTED]fea[REDACTED]79a58e488587b55fa79aa2775b","span_id":"f079dc0a[REDACTED]9cb40cd","op":"build","origin":"manual"}},"sdk":{"name":"sentry.java","version":"7.0.0","packages":[{"name":"maven:io.sentry:sentry","version":"7.0.0"}],"integrations":["UncaughtExceptionHandler","ShutdownHook"]},"tags":{"AGP_VERSION":"8.5.0","includeNativeSources":"false","ignoredBuildTypes_set":"true","tracing_enabled":"true","includeSourceContext":"false","autoInstallation_enabled":"true","uploadNativeSymbols":"false","autoUpload":"true","includeDependenciesReport":"true","SDK_VERSION":"7.[REDACTED].0","dexguardEnabled":"true","tracing_features":"[FILE_IO, OKHTTP, COMPOSE]","tracing_logcat_minLevel":"WARNING","tracing_debug":"false","tracing_forceInstrumentDependencies":"false","SENTRY_CLI_VERSION":"2.32.[REDACTED]","ignoredVariants_set":"false","debug":"true","GRADLE_VERSION":"8.8","includeProguardMapping":"true","additionalSourceDirsForSourceContext_set":"false","BUILD_SYSTEM":"gradle","tracing_logcat_enabled":"true","autoInstallation_sentryVersion":"7.[REDACTED].0","autoUploadNativeSymbols":"true","autoUploadProguardMapping":"true","ignoredFlavors_set":"false","step":"3379458255_InjectSentryMetaPropertiesIntoAssetsTask_Decorated"},"release":"4.9.0","environment":"Android","platform":"java","user":{"id":"delivery-hero-pm","ip_address":"{{auto}}"},"server_name":"prd-linux-use5a-6[REDACTED]7[REDACTED]a0e9-070[REDACTED]-42ff-84c9-4b96484[REDACTED]eba[REDACTED].c.bitrise-workers.internal"} DEBUG: Envelope sent successfully. DEBUG: Envelope flushed DEBUG: Serializing object: {"sid":"ecbe7493-8732-4f28-b554-3d0300aa3f80","started":"2024-07-08T[REDACTED]2:0[REDACTED]:24.2[REDACTED]2Z","status":"exited","seq":[REDACTED]720442[REDACTED]00002,"errors":0,"duration":20[REDACTED]5.79,"timestamp":"2024-07-08T[REDACTED]2:35:00.002Z","attrs":{"release":"4.9.0","environment":"Android"}} DEBUG: Envelope sent successfully. DEBUG: Envelope flushed DEBUG: Shutting down
@ZeeshanShabbir could you post a little bit more log output? Is the uploadSentryProguardMappings${Variant} task not executed again?
@romtsn Yeah I coudn't find the uploadSentryProguardMappings${Variant} task in build logs.
Hey @romtsn, did you manage to have any update on this 🙏
Hi @romtsn, it's been a while. Do we have any update or estimate on when this issue will be resolved?
After some investigation I unfortunately have to conclude that our Sentry Android Gradle Plugin won't work with DexGuard for now. The reason is quite simple: DexGuard runs very late in the build process, giving our Plugin no chance to inject the required mapping UUID based on the output of DexGuard.
For an DexGuard enabled app, the task graph looks like the following. As you can see, our sentry tasks runs way too early:
:app:assembleRelease
+--- :app:dexguardApkRelease
...
| \--- :app:packageRelease
...
| +--- :app:compressReleaseAssets
| | +--- :app:injectSentryDebugMetaPropertiesIntoAssetsRelease <-- would need to run after dexguard in order to work properly
| | | +--- :app:generateSentryProguardUuidRelease
| | | \--- :app:mergeReleaseAssets
If we would run our tasks after DexGuard, it would also mean that we'd need to re-package and re-sign the app, which seems to be a bigger and brittle effort. Let me reach out to folks from DexGuard, maybe we can work on a solution together.
In the meantime you can work around this issue by injecting a matching UUID yourself.
- Add a meta entry for the mapping-uuid to
AndroidManifest.xml
<application>
<meta-data
android:name="io.sentry.proguard-uuid"
android:value="${sentryProGuardUuid}" />
- Extend your
app/build.gradlefile
This provides the sentryProGuardUuid manifest placeholder value on a per-variant basis. On top of that a custom sentry-cli upload task is defined.
android.applicationVariants.configureEach { variant ->
var flavor = variant.getMergedFlavor()
// Add additional identifiers if necessary, e.g. git commit hash, GITHUB_RUN_ID / GITHUB_RUN_NUMBER
var identifier = "${variant.applicationId}-${variant.versionCode}-${variant.versionName}-${variant.name}"
var proguardUuid = UUID.nameUUIDFromBytes(identifier.getBytes(Charset.forName("UTF-8"))).toString()
// set mapping uuid as placeholder for AndroidManifest.xml
flavor.manifestPlaceholders = ["sentryProGuardUuid": proguardUuid]
// custom upload task, requires sentry-cli to be installed
tasks.register("uploadSentryMappings${variant.name.capitalize()}", Exec) {
commandLine(
"sentry-cli",
"upload-proguard",
"--uuid",
proguardUuid,
project.layout.buildDirectory.dir("outputs/dexguard/mapping/apk/${variant.name}/mapping.txt").get().toString(),
"--version-code",
variant.versionCode.toString(),
"--app-id",
variant.applicationId,
"--version",
variant.versionName
)
// path to the sentry.properties file, defining org and project
var propertiesPath = new File(project.layout.projectDirectory.asFile.parentFile, "sentry.properties")
environment("SENTRY_PROPERTIES", propertiesPath.toString())
// if not set already, define the auth token for upload here
// environment("SENTRY_AUTH_TOKEN", "<auth-token>")
}
}
- Build your app and upload the mapping file
./gradlew :app:assembleRelease && ./gradlew :app:uploadSentryMappingsRelease
e meantime you can work around this issue by injecting a matching UUID yourself.
Thanks @markushi for such great response. The point is only injecting a matching UUID on the manifest and using the same UUID for uploading, right?
My question is because we have a different pipeline and I was wondering if we could pass this "uuid" as an ambient variable to the Gradle and then execute the sentry-cli in our GitLab pipeline, using the same variable for upload.
We wish to not use gradle for uploading the files, but using our pipeline directly.
Does my plan make sense?
Thanks @markushi for such great response. The point is only injecting a matching UUID on the manifest and using the same UUID for uploading, right?
My question is because we have a different pipeline and I was wondering if we could pass this "uuid" as an ambient variable to the Gradle and then execute the
sentry-cliin our GitLab pipeline, using the same variable for upload. We wish to not use gradle for uploading the files, but using our pipeline directly.Does my plan make sense?
Yes, you're right: It's all about injecting a matching UUID. It doesn't really matter who/how the UUID is generated. As long as it ends up in the AndroidManifest.xml (or is set via SentryOptions.setProguardUuid()) and matches the one being used to upload the mapping file, you'll be fine.
The Sentry Android Gradle Plugin is using sentry-cli under the hood for uploading the mapping file, so if you use sentry-cli directly, there should be no difference.