paradox
paradox

Reputation: 1276

How to get android application name from apk file

How do I get the android application name from a apk file programatically outside an android environment? I have tried parsing androidmanifest.xml but it only shows the package name ( which may not be very informative at times)

Upvotes: 5

Views: 5493

Answers (2)

5p0ng3b0b
5p0ng3b0b

Reputation: 567

Can also be done with apktool.

#!/bin/sh
if [ -z "$1" ]; then echo ${0##*/} useage: ${0##*/} /path/to/your.apk; exit; fi
APKTOOL=$(which apktool apktool.sh | head -1); if [ -z "$APKTOOL" ]; then echo "Error: Could not locate apktool wrapper script."; exit; fi
TMPDIR="/tmp/apktool"
rm -Rf $TMPDIR
$APKTOOL d -q -f -s --force-manifest -o $TMPDIR $1
LABEL=$(cat $TMPDIR/res/values/strings.xml | grep 'string name="title"' | sed -e 's/.*">//' -e 's/<.*//')
rm -Rf $TMPDIR
echo ${LABEL}

Upvotes: 1

xhienne
xhienne

Reputation: 6134

If you are using Linux, this command will give you the application name:

aapt dump badging your.apk | sed -n "s/^application-label:'\(.*\)'/\1/p"

You'll have to install aapt first.

Upvotes: 8

Related Questions