Repository navigation
fix(meta-loader): repackage obfuscated classes to prevent namespace collisions in inject mode - #122
Merged
JingMatrix merged 2 commits intoOct 23, 2026
Conversation
…ollision in multi-dex inject mode
Owner
|
A duplicate of my previous trial in a85a0fa. Let me check more. |
The relocated classes are the vendored org.lsposed.hiddenapibypass, so org.lsposed.external names them for what they are rather than for the module they travel in. The comment records why the rule is needed at all and why the namespace has to stay distinct per injected dex.
JingMatrix
force-pushed
the
fix/metaloader-repackage-classes
branch
from
October 23, 2026 10:12
18ef2c7 to
b344d2a
Compare
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.
Problem
When patching an application with
--injectdex(injectDex = true),metaloader.dexis appended asclasses(N+1).dexalongside the target application's original DEX files.Because
meta-loader/proguard-rules.proonly keptLSPAppComponentFactoryStubwithout specifying-repackageclasses, R8/ProGuard shrinks and obfuscates internal dependencies (HiddenApiBypass,projects.share.java) into single-letter classes in the default root package (La;,Lb;,Lc;,Ld;,Le;,Lf;,Lg;,Lh;,Li;).If the target application is also compiled with R8/ProGuard, its primary
classes.dexoften already contains classesLa;throughLi;. When Android'sPathClassLoaderattempts to resolveHiddenApiBypasshelper classes (such as dummy stub classg.classused to computeartMethodandartFieldoffsets), Android resolves the target app's unrelated class fromclasses.dexinstead of the loader's class inclasses(N+1).dex.This causes a
NoSuchMethodExceptionduring<clinit>, causingHiddenApiBypassto fail withExceptionInInitializerError. As a result,LSPAppComponentFactoryStubfails to queryIPackageManagerand crashes immediately on launch with:Solution
-repackageclasses org.lsposed.lspatch.metaloadertometa-loader/proguard-rules.pro.org.lsposed.lspatch.metaloadernamespace, preventing collisions with root-level classes in target multi-dex APKs.Validation
./gradlew :meta-loader:assembleReleaseand inspected the resultingclasses.dexwithdexdump. Verified all classes reside strictly underLorg/lsposed/lspatch/metaloader/*:Lorg/lsposed/lspatch/metaloader/LSPAppComponentFactoryStub;Lorg/lsposed/lspatch/metaloader/a;..i;injectDex = true. The loader bootstraps successfully without the previousIllegalStateException/ collision crash.