Extract app icon from apk file
- Rename the .apk file to .zip
- Unzip it with a tool like 7zip
- Find the icons as png files under:
/res/drawable-hdpi/icon.png
Edit: Note that this file is not present in all apk files but in most of them. I could not find a better solution besides extracting all .png files and picking one from the list.
//if your apk is not installed ..only having .apk on sdcard
String APKFilePath = "mnt/sdcard/myapkfile.apk"; //For example...
PackageManager pm = getPackageManager();
PackageInfo pi = pm.getPackageArchiveInfo(APKFilePath, 0);
// the secret are these two lines....
pi.applicationInfo.sourceDir = APKFilePath;
pi.applicationInfo.publicSourceDir = APKFilePath;
//
Drawable APKicon = pi.applicationInfo.loadIcon(pm);
String AppName = (String)pi.applicationInfo.loadLabel(pm);
you can refer this link
Get-apk icon
aapt
tool ships with Android SDK, found under platform-tools
should give you the details you need. apktool ships with aapt.
aapt d --values badging payload.apk
Using this output, you can extract the icon file out of apk (which is a zip file).