error: unexpected element <uses-native-library> found in <manifest><application>.
komali2 opened this issue · 2 comments
I think this is a very cool tool that I've found very useful, so I hope I can help narrow down a possible bug.
I believe this is a bug with apk-mitm
rather than apk-tools
, I'll demonstrate why momentarily.
Using any Headspace APK or APKX (not sure if I can link directly), run apk-mitm
. aapt2
fails, and so does fallback aapt
.
apk-mitm Headspace_\ Sleep\ \&\ Meditation_4.188.0_Apkpure.xapk
╭ apk-mitm v1.2.1
├ apktool v2.6.1
╰ uber-apk-signer v1.2.1
Using temporary directory:
/tmp/apk-mitm-b0a15db24ae9e1cd536b97ff8a97a01f
✔ 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.1
I: Checking whether sources has changed...
I: Checking whether sources has changed...
I: Checking whether sources has changed...
I: Checking whether sources has changed...
I: Checking whether sources has changed...
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: <tmp_dir>/base-apk/decode/res navigation
brut.androlib.AndrolibException: brut.common.BrutException: could not exec (exit code = 1): [/tmp/brut_util_Jar_122576267098225401125692236861886579432.tmp, p, --forced-package-id, 127, --min-sdk-version, 21, --target-sdk-version, 33, --version-code, 350869, --version-name, 4.188.0, --no-version-vectors, -F, /tmp/APKTOOL13155722005023290828.tmp, -e, /tmp/APKTOOL2959610864625610547.tmp, -0, arsc, -I, <tmp_dir>/framework/1.apk, -S, <tmp_dir>/base-apk/decode/res, -M, <tmp_dir>/base-apk/decode/AndroidManifest.xml]
The full logs of all commands are available here:
/tmp/apk-mitm-b0a15db24ae9e1cd536b97ff8a97a01f/logs
Note that the above logs is simply aapt failing as expected, in a situation that calls for aapt2, as I understand it. The real reason is in the aapt2 failed log:
decoding.log: https://pastebin.com/aVkmN4rW
encoding-aapt2.failed.log: https://pastebin.com/qe4b9NL1
encoding-aapt.failed.log: https://pastebin.com/BhbxqyTu
I: Building resources...
W: /tmp/apk-mitm-b0a15db24ae9e1cd536b97ff8a97a01f/base-apk/decode/AndroidManifest.xml:373: error: unexpected element <uses-native-library> found in <manifest><application>.
W: /tmp/apk-mitm-b0a15db24ae9e1cd536b97ff8a97a01f/base-apk/decode/AndroidManifest.xml:374: error: unexpected element <uses-native-library> found in <manifest><application>.
brut.androlib.AndrolibException: brut.common.BrutException: could not exec (exit code = 1): [/tmp/brut_util_Jar_4763018127864958778385601174142376053.tmp, link, -o, /tmp/APKTOOL3117566114061110949.tmp, --package-id, 127, --min-sdk-version, 21, --target-sdk-version, 33, --version-code, 350869, --version-name, 4.188.0, --no-auto-version, --no-version-vectors, --no-version-transitions, --no-resource-deduping, -e, /tmp/APKTOOL12629253610331467856.tmp, -0, arsc, -I, /tmp/apk-mitm-b0a15db24ae9e1cd536b97ff8a97a01f/framework/1.apk, --manifest, /tmp/apk-mitm-b0a15db24ae9e1cd536b97ff8a97a01f/base-apk/decode/AndroidManifest.xml, /tmp/apk-mitm-b0a15db24ae9e1cd536b97ff8a97a01f/base-apk/decode/build/resources.zip]
This error is identical if I do an apk version or different version number of the Headspace app.
I believe this is a bug with apk-mitm
because:
apktool d Headspace_\ Sleep\ \&\ Meditation_4.182.0_Apkpure.apk
apktool b Headspace_\ Sleep\ \&\ Meditation_4.182.0_Apkpure/
Results in no errors.
I: Using Apktool 2.6.1
use newest apktool with --apktool
Ok, I did that, and it fixed the issue. Thanks!