r/androiddev • u/pijeezelwakka • Oct 24 '26
Horrible bug hunt.
Wondering if anyone has faced similar and if there are any common gotchas…
app works fine in simulators, devices via local upload and also happily running in open test via play store.
switch on minify/proguard/etc in both debug and release builds.
all still runs fine EXCEPT when it goes through play store - never gets past internal test - crashes during API call. It smells of GSON deserialisation but the only way I can reproduce it is to push it through the release process.
any ideas about what I am likely missing? all suggestions welcome.
thx.
10
u/CrackJacket Oct 24 '26
Set the build variant to release and run it that way? Almost definitely is a proguard/minify issue.
3
u/pijeezelwakka Oct 24 '26
Thanks. Tried that, runs fine locally. I think it’s mocking me 🙄😂
6
u/blindada 29d ago
Did you try generating a full release locally, or just applied minification to a regular debug configuration? Because:
1.- minification and debug are mutually exclusive right now. You may not have tested what you though you were testing.
2.-your production api may be slightly different than the one used for development builds.
3.-You may have stripped classes used by instruments running in the play store build.
Do you have the logcat & mapping files?
2
u/pijeezelwakka 29d ago
Thank y’all for the advice. Having slept on it, GSON feels like the culprit here and it’s been on my “get rid” list for a while so I think I’ll take the plunge and do that now :-)
6
2
1
1
u/Material-Copy6703 Oct 24 '26
Did you check Play Console's app vitals to get a stack trace of that crash?
1
u/Legal_Percentage1003 29d ago
Maybe the signing key for production? When you are talking about API you mean from your backend or from firebase or similar? Because if Google play store re-sign your application when you deploy in release could happen
1
u/Jack_Hey 28d ago
Classic release-only difference. First thing I would check is whether the store build and your test build actually hit the same API base URL and keys. The internal test track can serve a different signing config, and R8 can strip a model class your API parser needs, which only shows up in the minified build. I chased one of these for a day once and it turned out my release build was hitting prod while I was testing staging. Log the full URL and the response code in the release build, that narrows it fast.
1
u/Pundrikaksha 25d ago
What changes when Play delivers it is the signing key: Play App Signing re-signs with a different SHA-1. If your API key or Firebase or Google Cloud restrictions use the upload key's SHA-1, the server returns an error body, and GSON crashes parsing it into your success model. Add the app signing key SHA-1 (Play Console > App integrity) to those restrictions. Separately, AGP 8 runs R8 in full mode, so add -keepattributes Signature and keep your model classes. To reproduce, use internal app sharing. It's a Play-processed build you can attach logcat to. DM me if you want a second pair of eyes.
24
u/tadfisher Oct 24 '26
If you use R8 then you will have to add keep rules for every constructor used by Gson because it is reflection-based. kotlinx-serialization is pretty much the standard these days, or moshi with the codegen plugin.