apk-mitm
apk-mitm copied to clipboard
Resource Building Error while Encoding Bundled apks
If I specify --no-res
flag to apktool, the build succeeds but there is no option to use that with apk-mitm.
I tried with apktool -r --force-manifest
inside apklab and it failed on zip align.
https://github.com/NickstaDB/patch-apk is not working either.
â• apk-mitm v1.1.0
├ apktool v2.6.0
â•° uber-apk-signer v1.2.1
√ Extracting APKs
√ Finding base APK path
√ Extracting APKs
√ Finding base APK path
> Patching base APK
√ Checking prerequisities
√ Decoding APK file
√ Applying patches
> Encoding patched APK file
↓ Encoding using AAPT2 [skipped]
→ Failed, falling back to AAPT...
× Encoding using AAPT [fallback]
→ I: Building resources...
Signing patched APK file
Signing APKs
Compressing APKs
Failed! An error occurred:
I: Using Apktool 2.6.0
I: Checking whether sources has changed...
I: Checking whether sources has changed...
I: Checking whether sources has changed...
I: Checking whether resources has changed...
I: Building resources...
W: invalid resource directory name: C:\Users\Mujtaba\AppData\Local\Temp\apk-mitm-ec4b6370d6fae52026ae264ac0edc349\base-apk\decode\res navigation
brut.androlib.AndrolibException: brut.common.BrutException: could not exec (exit code = 1): [C:\Users\Mujtaba\AppData\Local\Temp\brut_util_Jar_104686993936704712079094319632414520033.tmp, p, --forced-package-id, 127, --version-code, 49, --version-name, 5.9.9.29, --no-version-vectors, -F, C:\Users\Mujtaba\AppData\Local\Temp\APKTOOL15437756555489044834.tmp, -e, C:\Users\Mujtaba\AppData\Local\Temp\APKTOOL11557474778395504409.tmp, -0, arsc, -I, C:\Users\Mujtaba\AppData\Local\Temp\apk-mitm-ec4b6370d6fae52026ae264ac0edc349\framework\1.apk, -S, C:\Users\Mujtaba\AppData\Local\Temp\apk-mitm-ec4b6370d6fae52026ae264ac0edc349\base-apk\decode\res, -M, C:\Users\Mujtaba\AppData\Local\Temp\apk-mitm-ec4b6370d6fae52026ae264ac0edc349\base-apk\decode\AndroidManifest.xml]
encoding-aapt2.failed.log
I: Using Apktool 2.6.0
I: Checking whether sources has changed...
I: Smaling smali folder into classes.dex...
I: Checking whether sources has changed...
I: Smaling smali_classes2 folder into classes2.dex...
I: Checking whether sources has changed...
I: Smaling smali_classes3 folder into classes3.dex...
I: Checking whether resources has changed...
I: Building resources...
W: C:\Users\Mujtaba\AppData\Local\Temp\apk-mitm-ec4b6370d6fae52026ae264ac0edc349\base-apk\decode\res\animator\2130837504.xml:4: error: not well-formed (invalid token).
W: C:\Users\Mujtaba\AppData\Local\Temp\apk-mitm-ec4b6370d6fae52026ae264ac0edc349\base-apk\decode\res\animator\2130837504.xml: error: file failed to compile.
W: C:\Users\Mujtaba\AppData\Local\Temp\apk-mitm-ec4b6370d6fae52026ae264ac0edc349\base-apk\decode\res\animator\2130837519.xml:7: error: not well-formed (invalid token).
W: C:\Users\Mujtaba\AppData\Local\Temp\apk-mitm-ec4b6370d6fae52026ae264ac0edc349\base-apk\decode\res\animator\2130837519.xml: error: file failed to compile.
W: C:\Users\Mujtaba\AppData\Local\Temp\apk-mitm-ec4b6370d6fae52026ae264ac0edc349\base-apk\decode\res\animator\2130837520.xml:7: error: not well-formed (invalid token).
W: C:\Users\Mujtaba\AppData\Local\Temp\apk-mitm-ec4b6370d6fae52026ae264ac0edc349\base-apk\decode\res\animator\2130837520.xml: error: file failed to compile.
W: C:\Users\Mujtaba\AppData\Local\Temp\apk-mitm-ec4b6370d6fae52026ae264ac0edc349\base-apk\decode\res\animator\2130837525.xml:4: error: not well-formed (invalid token).
W: C:\Users\Mujtaba\AppData\Local\Temp\apk-mitm-ec4b6370d6fae52026ae264ac0edc349\base-apk\decode\res\animator\2130837525.xml: error: file failed to compile.
W: C:\Users\Mujtaba\AppData\Local\Temp\apk-mitm-ec4b6370d6fae52026ae264ac0edc349\base-apk\decode\res\color\2131099653.xml:4: error: not well-formed (invalid token).
W: C:\Users\Mujtaba\AppData\Local\Temp\apk-mitm-ec4b6370d6fae52026ae264ac0edc349\base-apk\decode\res\color\2131099653.xml: error: file failed to compile.
W: C:\Users\Mujtaba\AppData\Local\Temp\apk-mitm-ec4b6370d6fae52026ae264ac0edc349\base-apk\decode\res\color\2131099669.xml:4: error: not well-formed (invalid token).
W: C:\Users\Mujtaba\AppData\Local\Temp\apk-mitm-ec4b6370d6fae52026ae264ac0edc349\base-apk\decode\res\color\2131099669.xml: error: file failed to compile.
W: C:\Users\Mujtaba\AppData\Local\Temp\apk-mitm-ec4b6370d6fae52026ae264ac0edc349\base-apk\decode\res\color\2131099670.xml:4: error: not well-formed (invalid token).
W: C:\Users\Mujtaba\AppData\Local\Temp\apk-mitm-ec4b6370d6fae52026ae264ac0edc349\base-apk\decode\res\color\2131099670.xml: error: file failed to compile.
W: C:\Users\Mujtaba\AppData\Local\Temp\apk-mitm-ec4b6370d6fae52026ae264ac0edc349\base-apk\decode\res\color\2131099671.xml:4: error: not well-formed (invalid token).
W: C:\Users\Mujtaba\AppData\Local\Temp\apk-mitm-ec4b6370d6fae52026ae264ac0edc349\base-apk\decode\res\color\2131099671.xml: error: file failed to compile.
W: C:\Users\Mujtaba\AppData\Local\Temp\apk-mitm-ec4b6370d6fae52026ae264ac0edc349\base-apk\decode\res\color\2131099672.xml:4: error: not well-formed (invalid token).
W: C:\Users\Mujtaba\AppData\Local\Temp\apk-mitm-ec4b6370d6fae52026ae264ac0edc349\base-apk\decode\res\color\2131099672.xml: error: file failed to compile.
W: C:\Users\Mujtaba\AppData\Local\Temp\apk-mitm-ec4b6370d6fae52026ae264ac0edc349\base-apk\decode\res\color\2131099673.xml:4: error: not well-formed (invalid token).
W: C:\Users\Mujtaba\AppData\Local\Temp\apk-mitm-ec4b6370d6fae52026ae264ac0edc349\base-apk\decode\res\color\2131099673.xml: error: file failed to compile.
brut.androlib.AndrolibException: brut.common.BrutException: could not exec (exit code = 1): [C:\Users\Mujtaba\AppData\Local\Temp\brut_util_Jar_166937077007861435657146622088963295169.tmp, compile, --dir, C:\Users\Mujtaba\AppData\Local\Temp\apk-mitm-ec4b6370d6fae52026ae264ac0edc349\base-apk\decode\res, --legacy, -o, C:\Users\Mujtaba\AppData\Local\Temp\apk-mitm-ec4b6370d6fae52026ae264ac0edc349\base-apk\decode\build\resources.zip]
I have the same problem
Is there any solution you found?
+1
I had the same error. Mine was because some of the attribute names in the files mentioned in the error were numbers. Since there were a large number of files, I used this Node script to remove all number attributes using apk-mitm --wait flag. After having done that and fixing another type of error which involved replacing id with android:id, apk-mitm was succuessfully able to create the apk.
Errors during rebuilding resources may be related to https://github.com/iBotPeaches/Apktool/issues/3534
One way to know more about this is to interrupt the process and run apktool -v build
(I wish apk-mitm
could optionally pass this option to apktool
) then you'll have to figure out the source of your specific error.