5

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)

paradox
  • 1,248
  • 5
  • 20
  • 32

2 Answers2

6

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.

xhienne
  • 5,738
  • 1
  • 15
  • 34
1

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}
5p0ng3b0b
  • 511
  • 4
  • 10