Skip to content

Commit eb699b1

Browse files
ADFA-3604: Fix Gson model classes and JDI debugger connector stripped by R8 (#1615)
* ADFA-3604: Fix Gson model classes stripped by R8 (6th shrink bug) 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> * ADFA-3604: Fix JDI debugger connector stripped by R8 (7th shrink bug) 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> * ADFA-3604: Fix comment positional reference in proguard-rules.pro 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> --------- Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
1 parent 0fb615a commit eb699b1

0 file changed

File tree

    0 commit comments

    Comments
     (0)