Possible to avoid changes to assets? (sentry-debug-meta.properties)
Description
I'm using a tool to patch my app to avoid needing to create a new release for every change (Shorebird). However patches can not be made when assets have changed.
When using Sentry Android Gradle Plugin, the file sentry-debug-meta.properties is changed every time a new build is created which means I can't use shorebird to patch my app.
Is there a way around this?
Hey @Jonny1987, thanks for reaching out! This is an interesting use case we should definitely support. This issue most likely is caused by us generating a new ProGuard UUID due to ProGuard/R8 running again for the release build. We store an UUID identifier inside that file, in order to be able to de-obfuscate native (Java/Kotlin) stacktraces at a later point.
Could you elaborate a bit on your setup?
- If you rebuild your app, does ProGuard / R8 run?
- Does the Sentry Android Gradle plugin upload your ProGuard mappings?
- Do you have an special
sentry {}Gradle configuration?
Hi! Great, that's good to hear. Actually I think it's the bundle-ids which is changing on every build, but I think the ProguardUuids doesn't change if there are no native changes (since proguard mappings will only change if there are native changes, correct?). Native changes means I can't use shorebird patch anyway so this a change of ProguardUuids is not causing a problem.
Here is part of the output from shorebird patch which failed (the Bundle ID specified here is different to the bundle ID of the release build so I assume it's what is being changed in sentry-debug-meta.properties):
> compressing mappings
> uploading mappings
> Uploaded a total of 0 new mapping files
> Found 2 files
> Bundled 2 files for upload
> Bundle ID: 0672e9c4-aef3-4a64-94f6-44855aee411f
Created /Users/builder/clone/build/app/intermediates/sentry/release/source-bundle/0672e9c4-aef3-4a64-94f6-44855aee411f.zip
> Found 1 debug information file (1 with embedded sources)
> Prepared debug information file for upload
> Uploaded 1 missing debug information file
> File upload complete:
UPLOADED 0672e9c4-aef3-4a64-94f6-44855aee411f (0672e9c4-aef3-4a64-94f6-44855aee411f.zip; sources)
Running Gradle task 'bundleRelease'... 804.7s
✓ Built build/app/outputs/bundle/release/app-release.aab (93.9MB)
⠋ Verifying patch can be applied to release...
✓ Verifying patch can be applied to release (0.1s)
[WARN] Your app contains asset changes, which will not be included in the patch.
Changed files:
base/assets/sentry-debug-meta.properties
If you rebuild your app, does ProGuard / R8 run?
Yes, I have set minifyEnabled true in build.gradle which will run R8
Does the Sentry Android Gradle plugin upload your ProGuard mappings?
Yes, my sentry configuration in build.gradle has includeProguardMapping = true
Do you have an special sentry {} Gradle configuration?
Yes, here it is:
sentry {
debug = false
org = sentryOrganization
projectName = sentryProject
authToken = sentryAuthToken
includeProguardMapping = true
autoUploadProguardMapping = true
includeSourceContext = true
autoInstallation {
enabled = false
}
}
@Jonny1987 thanks for all the details! We'll have a look at this and probably provide you a snippet to work around this issue. Do you know if shorebird allows changes to the AndroidManifest.xml?
Hi, only dart changes can be patched currently with shorebird
Alright I see, let me read up on this regard and get back to you as soon as possible.
@Jonny1987 is there a generated-at timestamp comment in the sentry-debug-meta.properties file that differs between rebuilds (particularly on separate build machines or if the cache is cleared)?
(I'm wondering if this is the same as another issue I was considering reporting; trying to avoid duplication)
Quick update: We're still investigating, I'll get back to you as soon as possible.
@Jonny1987 is there a generated-at timestamp comment in the
sentry-debug-meta.propertiesfile that differs between rebuilds (particularly on separate build machines or if the cache is cleared)?(I'm wondering if this is the same as another issue I was considering reporting; trying to avoid duplication)
Hi, Sorry for the delay.... yes it looks like the only thing that is changing is actually the timestamp so if this didn't change (at least when the remaining contents of the file haven't changed) then this would fix the issue with shorebird
@jayaddison @Jonny1987 could you share which Sentry gradle plugin and Android gradle plugin (AGP) versions you're using?
@romtsn Sentry gradle plugin 5.2.0 AGP 8.4.0
@Jonny1987 thanks for the details, we'll look into addressing the timestamp issue. Meanwhile, could you update the sentry plugin to the latest version (5.8.1) and try it out? There was one change with regards to the assets folder, unsure if it will address the issue here, but worth giving it a try.
Thanks...yeah 5.8.1 still updates the timestamp on each build if the codebase has changed at all, even though the rest of sentry-debug-meta.properties hasn't changed
Does the sentry-debug-meta.properties file need to be included if only the timestamp has changed (due to their being dart code changes but no native changes)? I could do something to let shorebird upload the patch without this file if only the timestamp has changed, but I'm not sure if this would cause problems with sentry or not?
However, if this timestamp is never actually needed at all (even when there are native changes) then it would be better to remove this from sentry-debug-meta.properties so that a work around doesn't need to be created by developers when using tools like shorebird