Uh oh!
There was an error while loading. Please reload this page.
ADFA-3604: Fix Gson model classes and JDI debugger connector stripped by R8 - #1615
Conversation
Found via a "Failed to load template archive ... Abstract classes can't be instantiated!" error on-device. Same root cause as the other shrink bugs fixed in this branch: Gson deserializes these classes only via reflection (gson.fromJson(..., X::class.java)), never a direct `new` R8 can trace, so it strips the constructor and Gson's runtime then reports the class as abstract. Fixes templates-impl's TemplatesIndex/TemplateJson/etc., and two more instances found by auditing every gson.fromJson call site in the repo: OpenedFilesCache/OpenedFile (no prior rule at all) and the breakpoint persistence models. Verified on-device: templates load cleanly, zero FATAL EXCEPTION in logcat, Kotlin project init still succeeds. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Found via a "Network access error" dialog on-device -- misleading, since
the app's debug-connect failure handler always appends a network-access
suggestion regardless of actual cause. The real error was buried in
logcat: "java.lang.Error: no Connectors loaded" from
com.sun.tools.jdi.VirtualMachineManagerImpl, caused by a
ServiceConfigurationError failing to instantiate
SocketAttachingConnector/SocketListeningConnector. Same root cause as
the other shrink bugs: JDI loads these via ServiceLoader, which R8
can't trace, so it stripped their no-arg constructors.
This exact fix was already anticipated and left commented out in this
file ("Initial rules to enable when R8 is shrinking to address
exceptions") from before shrinking was ever genuinely enabled -- just
needed uncommenting now that it is.
Verified on-device: JDWP listener starts successfully, no dialog, zero
FATAL EXCEPTION in logcat.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>The Gson keep-rule comment said the templates.impl.zip rule was "above" when it's actually below in the file. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
There was a problem hiding this comment.
Claude Code Review
This repository is configured for manual code reviews. Comment @claude review for a one-time review, or @claude review always to subscribe this PR to a review on every future push.
Tip: disable this comment in your organization's Code Review settings.
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 Walkthrough
WalkthroughThe ProGuard configuration now uses package-wide keep rules for AndroidIDE and template ZIP models. It also enables retention rules for ChangesProGuard keep rules
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
Two more R8 shrink bugs in the ADFA-3604 series (Gson-via-reflection and JDI's ServiceLoader-based connectors -- same root cause as the earlier fixes already on
stage: R8 can't trace reflective/ServiceLoader instantiation, so it strips no-arg constructors it thinks are unused).d8b7f3f1d):templates-impl'sTemplatesIndex/TemplateJson/etc., plus two more found by auditing everygson.fromJsoncall site in the repo --OpenedFilesCache/OpenedFile(had no prior keep rule at all) and the breakpoint persistence models.74e27524a):SocketAttachingConnector/SocketListeningConnectorstripped, causingjava.lang.Error: no Connectors loaded(surfaced on-device as a misleading "Network access error" dialog -- the debug-connect failure handler always appends that suggestion regardless of actual cause). The fix was already anticipated and left commented out inproguard-rules.profrom before shrinking was enabled; just needed uncommenting.b4e28fe21): corrected a stale positional reference ("above" -> "below") in a proguard-rules.pro comment from the previous commit.Test plan
:app:assembleV8Releasebuilds clean from this branch and installs/runs without ANRsGenerated with Claude Code