Wednesday, February 1, 2017

4.2 jelly bean - How do I get Application name from APK file?


When we click on apk file on android phone (assuming allowed installation from unknown sources), Application name appears.


Example screen-shot for jackpal.androidterm-1.apk:


screen-shot


Now, If I want to get this Application Name "Terminal Emulator" from apk file (jackpal.androidterm-1.apk) without installation prompt, then How do I do that?


So, My question is How do I get Application name from an .apk file?


As you know (from screen-shot) I use terminal, also I've installed busybox. So, Is there any command (like: foo /path/to/.apk) with the help of which I can get application name?


If I've to use application to do that, then I recommend to suggest FLOSS type application.


Note:- This is not about getting package name but application name. Also I am not talking about application that is already installed.



Answer




Works only on Cyanogenmod or forks that base on CM:


aapt may not be present on your device. It's suspected that this binary is part of CyanogenMod (and its forks). Confirmed to be present on my S3 running Resurrection Remix (CM12.1), Izzy's Milestone² running CM11 and the LG P880 running CM11 as well.


You can use aapt (Android Asset Packaging Tool) to dump the data to your terminal.


Command:


aapt d badging 

call aapt
[d]ump the data
print the badging (label and icon) of



Your output will contain many lines beginning with application-label; those are localized labels so the one you are looking for is plain application-label:. Use grep to filter your output and you will end up with this command:


aapt d badging  | grep "application-label:"

This gives you the localized application label for a given apk.


Update: Thanks to Izzy for providing aapt for all devices running Android 4.1+:


Izzy put together an archive containing the aapt binary for ARM devices (nearly all phones and tablets use ARM CPUs).
Get it from his website: http://android.izzysoft.de/downloads.


Note: the command to get the actual application label is slightly different, you need to use awk to isolate the application label from the rest of the output:


aapt d badging  | grep "application: label" |awk '{print $2}'

No comments:

Post a Comment

samsung galaxy s 2 - Cannot restore Kies backup after firmware upgrade

I backed up my Samsung Galaxy S2 on Kies before updating to Ice Cream Sandwich. After the upgrade I tried to restore, but the restore fails ...