patch-apk
patch-apk copied to clipboard
Split APK - Fails to rebuilding as a single APK
Hi @NickstaDB,
$ apktool --version 2.6.1
$ objection version objection: 1.11.0
$javac -version javac 11.0.14
$java -version openjdk version "11.0.14" 2022-01-18 OpenJDK Runtime Environment (build 11.0.14+9-post-Debian-1) OpenJDK 64-Bit Server VM (build 11.0.14+9-post-Debian-1, mixed mode, sharing)
$adb --version 130 ⨯ Android Debug Bridge version 1.0.41 Version 29.0.6-debian Installed as /usr/lib/android-sdk/platform-tools/adb
Getting this error when using the tool:
./patch-apk.py mx.app.baz.superapp
Getting APK path(s) for package: mx.app.baz.superapp
[+] APK path: /data/app/mx.app.baz.superapp-k6iFcpQReEt2YH2X8sGqAQ==/base.apk
[+] APK path: /data/app/mx.app.baz.superapp-k6iFcpQReEt2YH2X8sGqAQ==/split_config.arm64_v8a.apk
[+] APK path: /data/app/mx.app.baz.superapp-k6iFcpQReEt2YH2X8sGqAQ==/split_config.en.apk
[+] APK path: /data/app/mx.app.baz.superapp-k6iFcpQReEt2YH2X8sGqAQ==/split_config.xxxhdpi.apk
Pulling APK file(s) from device.
[+] Pulling: mx.app.baz.superapp-base.apk
[+] Pulling: mx.app.baz.superapp-split_config.arm64_v8a.apk
[+] Pulling: mx.app.baz.superapp-split_config.en.apk
[+] Pulling: mx.app.baz.superapp-split_config.xxxhdpi.apk
App bundle/split APK detected, rebuilding as a single APK.
Extracting individual APKs with apktool.
[+] Extracting: /tmp/tmphy56zl0k/mx.app.baz.superapp-base.apk
Picked up _JAVA_OPTIONS: -Dawt.useSystemAAFontSettings=on -Dswing.aatext=true
[+] Extracting: /tmp/tmphy56zl0k/mx.app.baz.superapp-split_config.arm64_v8a.apk
Picked up _JAVA_OPTIONS: -Dawt.useSystemAAFontSettings=on -Dswing.aatext=true
[+] Extracting: /tmp/tmphy56zl0k/mx.app.baz.superapp-split_config.en.apk
Picked up _JAVA_OPTIONS: -Dawt.useSystemAAFontSettings=on -Dswing.aatext=true
[+] Extracting: /tmp/tmphy56zl0k/mx.app.baz.superapp-split_config.xxxhdpi.apk
Picked up _JAVA_OPTIONS: -Dawt.useSystemAAFontSettings=on -Dswing.aatext=true
Copying files and directories from split APKs into base APK.
Found public.xml in the base APK, fixing resource identifiers across split APKs.
[+] Resolving 475 resource identifiers.
[+] Located 475 true resource names.
[+] Updated 475 dummy resource names with true names in the base APK.
[+] Updated 909 references to dummy resource names in the base APK.
Found styles.xml in the base APK, checking for duplicate <style> -> <item> elements and removing.
[~] Warning: this is a complete hack and may impact the visuals of the app, disable with --disable-styles-hack.
Disabling APK splitting in AndroidManifest.xml of base APK.
Rebuilding as a single APK.
[+] Found res/navigation directory, rebuilding with 'apktool --use-aapt2'.
Picked up _JAVA_OPTIONS: -Dawt.useSystemAAFontSettings=on -Dswing.aatext=true
W: /tmp/tmphy56zl0k/mx.app.baz.superapp-base/AndroidManifest.xml:58: error: attribute android:localeConfig not found.
W: error: failed processing manifest.
brut.androlib.AndrolibException: brut.common.BrutException: could not exec (exit code = 1): [/tmp/brut_util_Jar_135143119796348520198674730633476222503.tmp, link, -o, /tmp/APKTOOL6470977918890387834.tmp, --package-id, 127, --min-sdk-version, 24, --target-sdk-version, 30, --version-code, 1121, --version-name, 1.7.0, --no-auto-version, --no-version-vectors, --no-version-transitions, --no-resource-deduping, -e, /tmp/APKTOOL7689051423198891197.tmp, -0, arsc, -I, /root/.local/share/apktool/framework/1.apk, --manifest, /tmp/tmphy56zl0k/mx.app.baz.superapp-base/AndroidManifest.xml, /tmp/tmphy56zl0k/mx.app.baz.superapp-base/build/resources.zip]
baseapkdir: /tmp/tmphy56zl0k/mx.app.baz.superapp-base
Error: Failed to run 'apktool b /tmp/tmphy56zl0k/mx.app.baz.superapp-base'.
Run with --debug-output for more information.
Any idea how to fix it?
Thanks.
This is a bug in apktool, not patch-apk: https://github.com/iBotPeaches/Apktool/issues/2756
So you'll have to wait for the next version of aptool to come out (2.6.2 according to milestones)
Use the jar 2.6.1 her: https://ibotpeaches.github.io/Apktool/ and change the path on the python file it work better
@jinrowarrior cold you explain it better ? i would like to find a workaround.
After you download the good version of apktool on jar
you modify the python file like this :
#######
#Wrapper to run apktool platform-independently, complete with a dirty hack to fix apktool's dirty hack.
#######
def runApkTool(params):
if os.name == "nt":
args = ["apktool.bat"]
args.extend(params)
#apktool.bat has a dirty hack that execute "pause", so we need a dirty hack to kill the pause command...
proc = subprocess.Popen(args, stdin=subprocess.PIPE, stdout=getStdout())
proc.communicate(b"\r\n")
return proc
else:
args = ["java"]
args.extend(['-jar','/home/auditeur/PATH/apktool_2.6.0.jar'])
args.extend(params)
return subprocess.run(args, stdout=getStdout())