You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Resource ID resolution: The base APK's resources.arsc does not contain entries for resources that reside in density/config splits. Without those entries, apktool decodes binary XML references as @null, corrupting the output. Solved by loading split resource tables as auxiliary packages in apktool-lib (see ReVanced/Apktool#3) before decoding the base. Split public.xml entries are also included in the base's generated public.xml so that patches resolving resources by name work correctly.
AAPT linking: The base resource table references drawables that physically reside in density splits. Without those files in the base res/ directory, AAPT fails to link. Solved by symlinking split res/ contents into the base decode directory (with copy fallback).
Package name sync: Android requires all split manifests to have the same package attribute as the base. Patches like GmsCore rename the base package, so syncSplitPackageNames() propagates the base package to all split manifests before compilation.
ABI split manifests: ABI splits have no resources.arsc but still need their manifest decoded (for package sync) and recompiled to binary XML. Handled by passing null for resPath to AAPT, which compiles only the manifest.
Other edge cases handled:
Config splits may contain no dex — catch EmptyMultiDexContainerException
New split(), splitDocument(), deleteSplit() public APIs for patches to access split resources
On dex in splits:
Feature module APKs can contain dex. From the Android docs, each module has its own dex/ directory, and feature APKs "contain code and resources for a feature of your app." Config splits (ABI, density, language) typically don't have dex. The code handles both cases by trying to read dex from each split and catching EmptyMultiDexContainerException for those that don't.
On resources in splits:
Multiple splits carry resources, not just one. The docs describe configuration APKs as including "native libraries and resources for a specific screen density, CPU architecture, or language." So density splits have drawables, language splits have strings, etc. For example, in YouTube's split APK bundle, 29 of 35 splits have their own resources.arsc. Only the 4 ABI splits (which contain just native .so libraries) have no resource table.
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
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
Add support for patching apps distributed as split APKs (base.apk + config splits for ABI, density, language).
Apk(Single/Split) replacing rawFileparameterpatcher(File, ...)overload preservedImplementation details
Resource ID resolution: The base APK's
resources.arscdoes not contain entries for resources that reside in density/config splits. Without those entries, apktool decodes binary XML references as@null, corrupting the output. Solved by loading split resource tables as auxiliary packages in apktool-lib (see ReVanced/Apktool#3) before decoding the base. Splitpublic.xmlentries are also included in the base's generatedpublic.xmlso that patches resolving resources by name work correctly.AAPT linking: The base resource table references drawables that physically reside in density splits. Without those files in the base
res/directory, AAPT fails to link. Solved by symlinking splitres/contents into the base decode directory (with copy fallback).Package name sync: Android requires all split manifests to have the same
packageattribute as the base. Patches like GmsCore rename the base package, sosyncSplitPackageNames()propagates the base package to all split manifests before compilation.ABI split manifests: ABI splits have no
resources.arscbut still need their manifest decoded (for package sync) and recompiled to binary XML. Handled by passingnullforresPathto AAPT, which compiles only the manifest.Other edge cases handled:
EmptyMultiDexContainerExceptionsplit(),splitDocument(),deleteSplit()public APIs for patches to access split resourcesTest plan
compileKotlinJvmpassesjvmTest(43 tests) passescheckLegacyAbipassesadb install-multiple— successDepends on: ReVanced/Apktool#3
Companion PRs: