Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 25 additions & 7 deletions app/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,12 @@
}
-keep class com.itsaky.androidide.utils.DialogUtils { public <methods>; }

# APK Metadata
-keep class com.itsaky.androidide.models.ApkMetadata { *; }
-keep class com.itsaky.androidide.models.ArtifactType { *; }
-keep class com.itsaky.androidide.models.MetadataElement { *; }
# Gson model classes deserialized only via reflection (gson.fromJson(...,
# X::class.java)), same "R8 strips the unreachable constructor" issue as
# templates.impl.zip above. Covers OpenedFilesCache/OpenedFile (no prior
# rule) as well as the APK metadata classes already listed individually.
Comment on lines +117 to +118

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Correct the relative rule reference.

The template rule is at Line 174, below this block. Change above to below, or remove the positional reference.

Proposed fix
-# templates.impl.zip above. Covers OpenedFilesCache/OpenedFile (no prior
+# templates.impl.zip below. Covers OpenedFilesCache/OpenedFile (no prior
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
# templates.impl.zip above. Covers OpenedFilesCache/OpenedFile (no prior
# rule) as well as the APK metadata classes already listed individually.
# templates.impl.zip below. Covers OpenedFilesCache/OpenedFile (no prior
# rule) as well as the APK metadata classes already listed individually.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@app/proguard-rules.pro` around lines 117 - 118, Correct the positional
reference in the comment describing templates.impl.zip near the
OpenedFilesCache/OpenedFile rules: change “above” to “below” to reflect the
template rule’s location, or remove the positional wording entirely.

-keep class com.itsaky.androidide.models.** { *; }
-keep class com.itsaky.androidide.lsp.debug.model.** { *; }

# Parcelable
-keepclassmembers class * implements android.os.Parcelable {
Expand Down Expand Up @@ -164,6 +166,13 @@
-keep class * implements com.google.gson.JsonSerializer
-keep class * implements com.google.gson.JsonDeserializer

# Gson model classes: nothing calls `new TemplatesIndex(...)` directly --
# only gson.fromJson(..., TemplatesIndex::class.java) does, via reflection.
# With no traceable constructor call, R8 strips the constructor and Gson's
# runtime then reports the class as abstract ("Failed to load template
# archive ... Abstract classes can't be instantiated!").
-keep class com.itsaky.androidide.templates.impl.zip.** { *; }

-keepclassmembers,allowobfuscation class * {
@com.google.gson.annotations.SerializedName <fields>;
}
Expand Down Expand Up @@ -197,9 +206,18 @@
-keep class com.itsaky.androidide.plugins.** { *; }
-keep interface com.itsaky.androidide.plugins.** { *; }

## Initial rules to enable when R8 is shrinking to address exceptions
#-keep class com.sun.tools.jdi.** { *; }
#-keep class com.sun.jdi.** { *; }
## ADFA-3604: JDI's SocketAttachingConnector/SocketListeningConnector are
## loaded via ServiceLoader (META-INF/services), which R8 can't trace, so it
## stripped their no-arg constructors. This surfaced as
## "ServiceConfigurationError: Provider ... could not be instantiated" ->
## "java.lang.Error: no Connectors loaded" from VirtualMachineManagerImpl,
## which the app then reports to the user as a generic "Network access
## error" (the debug-connect failure handler always appends a network
## suggestion regardless of cause) even though this has nothing to do with
## network permissions. This is exactly the exceptions these rules were
## anticipating -- enabling them now that shrinking is genuinely on.
-keep class com.sun.tools.jdi.** { *; }
-keep class com.sun.jdi.** { *; }

## R8 Kotlin metadata workaround for Kotlin 2.3.0 compatibility
## Suppresses D8 errors when parsing kotlin metadata for StopWatch inline functions
Expand Down
Loading