Keep only selected files/resources (eg AndroidManifest.xml) #3541
rebane2001
started this conversation in
Ideas
Replies: 2 comments
-
Here's a script I wrote for the time being in case anyone else has this use case: #!/usr/bin/env bash
set -euo pipefail
[ -z "${1-}" ] && echo "Usage: $0 example.apk [out.xml]" && exit 1
apkpath="$(realpath -- "$1")"
tmpdir="$(mktemp -d)"
# Make sure temp directory exists and is empty
[ -d "${tmpdir}" ] || exit 2
[ -z "$(ls -A "${tmpdir}")" ] || exit 3
pushd "${tmpdir}" || exit 4
apktool d -m "${apkpath}"
popd
mv -- "${tmpdir}/"*"/AndroidManifest.xml" "${2:-.}"
rm -r "${tmpdir}" |
Beta Was this translation helpful? Give feedback.
0 replies
-
You might be able to get closer with like
That would skip resources and sources and force the manifest. So you won't get everything resolved, but pretty close. We don't presently have flags to skip the libraries and unknown files. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Similar request to #1135.
There should be a flag/option to only extract certain files (at the very least for
AndroidManifest.xml
). I understand that skipping processing the rest of the apk altogether isn't always possible, but a flag that extracts everything to a temporary directory and then keeps the desired files would be nice to have. Right now you'd have to write a script to do this (create temp directory, run apktool, copy desired files, delete temp directory), which is ugly and inefficient.Apktool does excellent manifest decode oob, other tools such as
aapt
have a different output which might not fit some use cases.Thank you!
Beta Was this translation helpful? Give feedback.
All reactions