Extract adaptive launcher icon from Android apk as svg/png? - android

Is there a way to extract the launcher icon of an apk file, even if it is an adaptive icon (vector drawable)?
I couldn't find a single batch or python script to achieve this.
There are many scripts which use aapt, but they all just work for png files.
Note: I don't want to run this on the Android device itself.

Related

NativeScript 8.0.4 Android App Icon WILL NOT Change from default

I'm tearing my hair out over here. I've developed applications with earlier versions of nativescript and this has never been issue... This is my last effort before I just downgrade to an older version
I have ran the command tns resources generate icons ../icon.png and it claims to have successfully generated the icons and I can see them in the directory... build and deployed to phone. Still has the default nativescript icon
I went to App_Resources/Android/src/main/res and manually updated the ic_launcher.png file in every mipmap directory... build and deployed to phone, same result! Default icon
Tried deleting the platform/android directory and rebuilding. No luck
I searched from the root directory and I cannot figure out how the heck this default icon is appearing still!!!
Note: I was able to change the splash screen
Any help... please, thank you
I ended up solving this issue eventually, so for anyone this might help in the future... In the newer versions of NativeScript there is now a new folder in res called "mipmap-anydpi-v26" which uses vector graphics. If your on SDK 26+ it will automatically use this vector graphic and IGNORE every other PNG icon in all the other folders.
Your options to remedy this are either:
A) Delete this folder from the directory, which will force it to fall back to the regular PNG icon that's appropriate for the device resolution
B) Edit the file in the folder and update the SVG to use yours
I had a similar issue on nativescript 8.1.1, nativescript/android 8.1.1 with svelte 3.44.0. After running ns resources generate icons <icon-path> and ns resources generate splashes <splash-path>as show in this stack post here. Only the splashes were generated successfully. However the icons didn't work as described, hence I had to generate my app launcher icons using this service. Then I downloaded the zip file, unzipped it and copied the contents of the 'res' directory in the unzipped file to <project-directory>/App_Resources/Android/src/main/res to replace all the directories with the same names (i.e. mipmap-anydpi-v26, mipmap-hdpi etc). Then rebuilt and reran my application and everything worked fine.
Since 8.x Nativescript ships with the adaptive icons - since the old icons are outdated on more recent android phones, and usually look weird
1.Open a project in Android Studio and in the Project Explorer pane right-click on the app directory or any of the directories inside the app directory. In the context menu that opens select New > Image Asset
2.Once Asset Studio opens you'll see the new default app icon
3.The main thing to know about adaptive icons is that there are two layers, a foreground and background. The default foreground will be titled ic_launcher_foreground.xml and it is an SVG. Go ahead and click the ... button next to the path (image below) and select your app icon that you're going to use.
4.Now you can go ahead and set the other settings for your icon such as trim and the resize percentage. You'll also be able to change the default green background layer, select the Background Layer tab and you can repeat the same process. From experience, in a lot of cases you can use the Color radio button to set the color you'd like to use for your background layer.
5.Once you are finished with your icon configuration you can complete the wizard which will generate the various resources needed for your app. The new files will be located under the android app directory in src/main/res/ where you should see several mipmap- directories.
6.Now move all the files in mipmap- directories to your Nativescript's App_Resources mipmap folder
7.Once you have copied over the newly created icon files to the NativeScript project there is one final change you need for your application. The only change is to set the android:icon value to #mipmap/ic_launcher which is the resource location of the new files we added from the Android project from Android Studio.
Hope this helps to solve your issue
I always use NativeScript Sidekick to generate my icons. I don't know if that will yield different results from the tns command, but at least it's something else to try.

Flutter Android launcher icon looks very small

I'm using the flutter_launcher_icons package to generate launcher icons for both Android and iOS. Everything looks great on iOS, but on Android the icon looks very tiny:
It's the second one from the left. I've tried all kinds of things to get it to be bigger. I've tried several different source images to generate the icon, 512x512 and 900x900, but no matter what I do I can't get it to generate an icon as large as the others. I'm sure I'm missing something stupid here. This is my flutter_launcher_icons config:
flutter_icons:
android: true
ios: true
image_path: "assets/icon/icon_new2.png"
I would recommend you to use http://romannurik.github.io/AndroidAssetStudio/icons-launcher.html to generate your launcher icon : you'll be able to reduce padding to get an icon as big as possible. When you hit download, this will generate a zip archive containing a res folder with a subfolder for each size.
Let's then put manually the Android launcher icon :
In your config, put android: false so the flutter_launcher_icons plugins stops generating icons for android, and paste your generated subfolders in yourproject/android/res
I encountered the same issue as you, looks like we followed the same tutorials/links.
EDIT : If you still encounter issues, this thread may help you (almost a duplicate) App Icon on Device is too small
For all the flutter android projects, for those who are still facing issues after generating icons from here, http://romannurik.github.io/AndroidAssetStudio/icons-launcher.html follow the below steps,
Open your flutter project in Android Studio
Select the android folder and Right click
Select the option flutter->Open Android Module in Android Studio ( open in new window)
It will take a while, once its done, in the android project, right click on res->drawable folder, and create new image asset
Create the launcher icons using your image in this android studio wizard.
Once the launcher icons are created, build your apk or app bundle asusual from your flutter project. It should work fine now.
To complement the answer of the user TBG, in my case, the path where I had to put the res folder was in youproject/android/app/src/main/, replace what you have and voila, recompile your project.

Extract app icon from apk file [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 3 years ago.
Improve this question
I am in need of extracting the app icon from an apk-file.
I just need one icon, i don't want to extract everything else in the apk. The files are easy to get hold on, but how do I determine which icon file is the correct app-icon. I guess this is stored in the resource table? So I guess what I need is actually to read the resource table and I hope that from the resource table I can determine the icon file namne which I can then extract from the app.
I need a simple tool for this, i know about apktool that can extract the entire apk file but this is not what I want since
it does a lof of other stuff that I dont need (decompile, decompress other files etc)
it takes a lot of time to run
Is there any other tool I can use just to get hold of the icon file path?
All suggestions are appreciated
EDIT: To clarify, I am not trying to do this on the device. I am trying to do this on a PC.
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).
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
As to my knowledge (and according to Wikipedia as well), APK files are ZIP file formatted packages. So I think you can just use any unzip tool to unzip the apk-file and take the icon you want. For the launcher-icon, just open the AndroidManifest.xml file and have a look at the android:icon property of the <application>. It probably looks something like so:
android:icon="#drawable/ic_launcher"
The icon file would then be res/drawable-<dim>/ic_launcher.png, where <dim> can be any of ldpi, mdpi, hdpi, xhdpi which stand for different resolutions. The largest image would be in xhdpi or hdpi.
This bash function will extract the icon and display it with preview. If you're not on a mac, then you could use the display command from ImageMagick.
preview-android-icon () { unzip -p $1 $(aapt d --values badging $1 | sed -n "/^application: /s/.*icon='\([^']*\).*/\1/p") > /tmp/$$.png && preview /tmp/$$.png; }
Use it like this:
preview-android-icon /path/to/your.apk
Software
You can also try these GUI tools to easily extract Android app icon:
APK Icon Editor – simple and intuitive.
APK Editor Studio – more advanced but still easy to use.
Description
Though the Apktool is used under the hood, the GUI front-end makes it very simple to extract or change APK icons.
The proper application icons are automatically parsed from the manifest and the internal structure, so there is no need to manually search for the needed resource files.
Both tools help you to easily edit, replace or extract icons via user-friendly GUI.
Both tools are available for Windows, macOS and Linux.
Both tools are open-source (written in C++/Qt).
Disclaimer
I am the author of these tools.
if you are novice like me you can use android app Called My APK (Google Play Link) to extract apps icons on your android phone either this app installed or you just have downloaded the apk files from outsources like apkMirror, APKpure, AppsAraby
apktool's source is available. Since resource extraction and code decompilation are quite different, I suspect it would be easy to modify it to remove code decompilation to minimize it to what you need.
As to determining the icon file name, you base that on the contents of AndroidManifest.xml, but you may need to account for multiple versions of the icon based on screen density, orientation, language configuration, etc.

android: get files icons saved in the system itself

I know the following happens in Windows [desktop]:
the system has an icon for each extension, and a default one for new ones.
When a new program is installed, it saves its icons to its extensions in the system [ex. upgrading Word 2007 to 2010 changes the icons for .docx files]
Now I want to know how to get those icons in android. I'm not sure if it follows the same scenario, BUT, i have a file explorer app which displays those icons. From my use of it, i know that those icons cannot be hard coded [except for the folder icon]. For example, after installing Tango, its icon took over the .ini files
My question is, How to get those icons? I'm kinda doing a file explorer app [that serves certain needs no other app does]
Android doesn't provide that functionality. You have either hard-code drawables for most-used file types into your application or download them from Internet.
You'd have to create your own icons, scan for the file types found, match those to some internal list and display the according icon (Drawable) in a Imageview in your ListView. Assuming you are using a ListView to display the files found here ofcourse.

Change Android app icons in APK?

Is it possible to change the app icon in an APK in Android apps? I have a tablet running Android 2.2 and the icons are too low-res, so I want to replace them. I tried unzipping the APK, changing the icon and re-zipping, but it didn't work. Is there any way I can change the icon, even programmatically, to reflect the higher-res icon?
APK files are actually nothing more than zip files. If you just want to replace images, then the easiest way is to open the apk file in 7-zip or winrar and replace the png files in there with your own. Just drag your new files to the 7-zip window.
Note that I said "open" and not "unzip". Once you decompress it, the signature will no longer be valid.
Another option is to use APKManager to do it. This way you do not need to install it in /system/app:
Download APK Manager
Put the .apk in "place-apk-here-for-modding"
Run the script.bat and extract it.
Drop the new PNG files in /res/drawable-?dpi overwriting the old ones.
Run ZIP .apk and select option 2 Regular APK
Sign the APK
Install
Summary
One the simplest ways is to change APK icons via user-friendly GUI tools:
APK Editor Studio – advanced but still easy-to-use APK editor.
APK Icon Editor – plain and simple APK editor.
Both tools are free and open-source (written in C++/Qt) with the Apktool used under the hood.
Features
Automatically pack, sign and optimize your APK.
Automatic conversion between PNG, BMP, JPEG, ICO, GIF, etc.
Available for Windows, macOS and Linux.
Disclaimer
I am the author of these tools.
If you want change android application icon programatically then you can set it into AndroidManifest.xml file, in the application tag by setting the android:icon property. But if you want to change the icon of third party applications then you cant.
See this solution
Please have a look at this one for designing icons for high, medium and low density phones:
http://developer.android.com/guide/practices/ui_guidelines/icon_design_launcher.html

Categories

Resources