Repository navigation
Preserve MainHook constructor in release builds - #313
Merged
Merged
Conversation
In release builds, R8 optimization stripped the parameterless constructor for MainHook because keeping only the class does not prevent R8 from shrinking default constructors. Because Xposed / Vector instantiates the entry point reflectively, the module failed to instantiate and hook. Explicitly keep the public no-argument constructor in ProGuard rules and add an apkanalyzer verification step to the GitHub Actions release workflow.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
In release builds of ChromeXt 3.9.0, R8 optimization stripped the parameterless constructor for
org.matrix.chromext.MainHookbecause keeping only the class (-keep class org.matrix.chromext.MainHook) does not preserve its default constructor under recent R8/AGP versions.Since Xposed / Vector instantiates the entry point reflectively using the default constructor, the module failed to instantiate at runtime on release builds, rendering hooks inactive across all supported browsers.
Changes
app/proguard-rules.proto explicitly keeppublic <init>();onorg.matrix.chromext.MainHook..github/workflows/android.ymlusingapkanalyzerto verify thatorg.matrix.chromext.MainHook.<init>()Vis preserved in unsigned release APKs.Verification
./gradlew assembleReleaseand verified withapkanalyzerthatMainHook.<init>()Vis present in DEX.