Obtain Icon from APK File

Asked 2 years ago, Updated 2 years ago, 120 views

Learn how to extract icons from APK files
As /sdcard/**.apk/res/drwable-hdpi-v4/ic_launcher.png, this is
It says it's not a file.
I think it's troublesome to treat zipfile as a file.

android

2022-09-30 21:26

2 Answers

You can deploy (or rebuild) apk files using apktool.
You need a Java environment to run.
https://ibotpeaches.github.io/Apktool/install/

>apktooled-s TARGET.apk-o OUTDIR


2022-09-30 21:26

If you want to retrieve it from the Android app,

String APKFilePath="mnt/sdcard/myapkfile.apk";
 PackageManager pm = getPackageManager();
 PackageInfo = pm.getPackageArchiveInfo (APKFilePath, 0);
 pi.applicationInfo.sourceDir=APKFilePath;
 pi.applicationInfo.publicSourceDir=APKFilePath;
 Drawable APKicon=pi.applicationInfo.loadIcon(pm); //icon
 String AppName=(String)pi.applicationInfo.loadLabel(pm); // App name

APKicon is a drag, so it can be used as setIcon() in Dialog


2022-09-30 21:26

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.