The development of a mobile product is completed not by writing business logic code, but by paying attention to the details that the user sees first. Application icon becomes the face of your software in the Google Play Store and on the device desktop. It is this small graphic element that often influences a personโs decision to click the โInstallโ button or scroll further through the feed. In the Android Studio environment, the process of adding images is strictly regulated and requires compliance with specific rules for naming and placing files.
Many novice developers make the mistake of simply dragging an image into a folder drawable, which can lead to incorrect display on different devices. The Android system uses adaptive icons that change shape depending on the OS version and smartphone launcher. To make your product look professional on any screen, from budget Xiaomi to flagship Samsung, you need to use the built-in IDE tools and follow Material Design guidelines.
In this article we will analyze in detail the entire path from preparing the source image to the final compilation of the project. You will learn how folders differ mipmap from drawable, how to work with vector graphics and why pixel densities cannot be ignored. We'll touch on the technical aspects of creating responsive icons, which were introduced in Android 8.0, and look at manual configuration methods for those cases when automatic assistants can't cope with the task.
Preparing graphic assets before importing
Before opening a project in Android Studio, it is critical to properly prepare the source image file. The industry standard requires that the master copy of the icon have a resolution of 1024ร1024 pixels. This allows compression algorithms to correctly generate smaller versions for low-density screens without losing quality or introducing anti-aliasing artifacts.
The file format also plays a critical role. For raster graphics, the ideal choice is PNG with support for a transparent channel (alpha channel).
โ ๏ธ Warning: Never use the JPG format for application icons, as it does not support transparency and will add a white square background around your logo, which looks extremely unprofessional.If your logo is made in the form of vectors, it is preferable to use a format SVGthat allows you to scale the image without losing clarity on any display.
Use tools like Image Asset Studio or online converters to check background transparency before starting work in the IDE.
It is important to consider the โsafe zoneโ inside the icon square. Key elements of the logo should be centered, not touching the edges of the canvas, as various launchers may crop the image into a circle, rounded square, or other shape. Leave approximately 5-10% of the edge space empty to ensure visual harmony on any device.
Using Image Asset Studio's built-in wizard
The most reliable and fastest way to add an icon is to use the specialized wizard built directly into Android Studio. This tool automatically creates all the necessary image variations for different screen densities and generates configuration files for adaptive icons. To run it, right-click on the folder res in the project window.
Select the path in the context menu New โ Image Asset. A settings dialog will open where you can select the type of icon: Launcher Icons for the main application icon or Notification Icons for notifications in the status bar. In the Asset Type field you can select the image source: a local file, clipart from the Material collection or a text caption.
After selecting a file, the wizard will offer to configure cropping and scaling. The interface provides a preview of how the icon will look on different versions of Android, including adaptive mode. Here you can also configure the background color for older versions of the system that do not support adaptive layers. Once setup is complete, click Next and then Finishto have the IDE generate assets.
โ๏ธ Setting up Image Asset Studio
Folder structure mipmap and differences with drawable
Beginners often wonder why application icons should be placed in folders mipmap, and not in the usual ones drawable. Historically, resources in drawable can be removed by the system when changing screen density to save memory if they are not used directly in the interface. The application icon should always be available, even if the device is operating in low density mode, and the original was created for high density.
Folders mipmap specially designed for storing launcher icons. They are not subject to compression optimization as aggressively as regular interface images. Inside the directory res you will see several subfolders with suffixes indicating pixel density: mdpi, hdpi, xhdpi, xxhdpi and xxxhdpi.
| Screen density | Folder suffix | Icon size (px) | Example devices |
|---|---|---|---|
| Average | mipmap-mdpi |
48ร48 | Old smartphones, tablets |
| High | mipmap-hdpi |
72ร72 | Budget Android models |
| Ultra-high | mipmap-xhdpi |
96ร96 | Mid market segment |
| Very ultra-high | mipmap-xxhdpi |
144ร144 | Flagships (Samsung, Pixel) |
| Extreme | mipmap-xxxhdpi |
192ร192 | Modern top device |
Using the correct folder ensures that the device with the screen xxxhdpi will download the maximum quality picture, and not the stretched version from the folder mdpi. This directly affects the user's perception of the quality of the application. Ignoring this hierarchy may result in your icon appearing blurry or pixelated on modern screens.
Manually adding and setting up adaptive icons
Starting with Android 8.0 (API level 26), the system supports adaptive icons, consisting of two layers: foreground (foreground) and background (background). This allows the launcher to apply dynamic masks, turning a square icon into a circle, drop or rounded square depending on the user's theme.
For manual configuration, you need to create an XML resource file in the folder mipmap-anydpi-v26. This directory contains resources that are only used on devices running Android 8.0 and higher. The file is usually named ic_launcher.xml and refers to two separate images or vector files. The file structure looks like this:
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android"><background android:drawable="@color/ic_launcher_background"/>
<foreground android:drawable="@drawable/ic_launcher_foreground"/>
</adaptive-icon>
If you are adding icons manually without a wizard, make sure you have separate files for each layer. The foreground should contain only the logo itself on a transparent background, and the background should be a solid color or gradient.
โ ๏ธ Attention: When creating manually, make sure that the file names in the XML match the actual names in the resource folders, otherwise the compiler will throw a build error.
What to do if you need to support older versions of Android?
For versions below 8.0, the system will ignore the v26 folder and use a regular raster icon from the mipmap-hdpi and other folders. Therefore, be sure to generate full raster versions for all densities, not just the XML configuration.
Using vector graphics (VectorDrawable) for the foreground is best practice. This reduces the APK file size and ensures perfect clarity on all future screens. However, if your logo contains complex effects, shadows or gradients that the vector does not support, you will have to use high-resolution raster images.
Checking display and debugging resources
After adding an icon, it is not enough to simply assemble the project. You need to check how resources are displayed on real devices or emulators with different screen characteristics. There is a resource preview tool, but nothing replaces visual inspection on a physical device. Run the application on a low-density emulator (for example, Android Studio there is a tool App Links Assistant and resource previews, but nothing replaces visual inspection on a physical device.
Run the application on a low-density emulator (for example, Nexus One) and on a high-density emulator (for example, Pixel 6). Compare the clarity of the lines and the absence of compression artifacts. Pay special attention to the dark theme: if your icon background is black and the system switches to dark mode, the icon may blend in with the desktop wallpaper.
Always test the icon on devices with different screen sizes and Android versions, as rendering may vary depending on the shell manufacturer.
You can use the code in to check resource paths method onCreate activities. Logging the resource name will help ensure that the application is loading exactly the file you expect. Use the command Log.d("IconCheck", getResources().getResourceEntryName(R.mipmap.ic_launcher)) to debug.
Common errors and solutions
One โโof the most common problems is resource caching by the development environment. It happens that you replaced the icon file, rebuilt the project, but the old image remained on the emulator. In this case, the menu command Build โ Clean Project, followed by Rebuild Project, helps. This forces Android Studio to completely recompile all resources.
Another common error is mismatched file names. On Android, resource names must contain only lowercase letters, numbers, and underscores. Using capital letters, spaces, or special characters (for example, MyIcon.png) will result in a compilation error. The correct name will look like my_icon.png.
- ๐ซ Compilation error due to invalid characters in the file name.
- ๐ผ๏ธ Blurred image on screens with high pixel density.
- ๐ The icon is not visible on dark wallpapers due to lack of contrast background.
- ๐ฆ Increased APK size due to the use of uncompressed bitmaps.
If you are faced with the fact that the icon is displayed correctly in the studio, but after installation on the phone it looks like a standard green robot, check the file AndroidManifest.xml. Make sure that the tag <application> attribute android:icon points to the correct resource: android:icon="@mipmap/ic_launcher". Sometimes when refactoring a project, links can get lost.
Use the WebP format for raster icons if you need to critically reduce the size of the application, but make sure that all target devices support this format.
Why is the icon in Google Play Console different from the icon in the application?
The icon in the Google Play store (High Res Icon) and the icon inside the application (Launcher Icon) are two different resources. The store requires a 512x512 pixel image without transparency, which is uploaded separately in the developer console. It is not taken automatically from the application code.
Is it possible to change the application icon dynamically after installation?
Yes, starting with Android 7.1, there is an API ShortcutManagerthat allows you to create shortcuts with custom icons. However, replacing the main launcher icon (ic_launcher) is only possible by disabling the current activity component and enabling an alternative alias with another icon in the manifest.
Which format is better: PNG or WebP for an icon?
PNG is traditionally used for launcher icons due to maximum compatibility. WebP provides better compression, but very old devices (Android 4.0 and below) may have rendering issues, although for modern projects WebP is the preferred choice to save space.
What should you do if the Image Asset wizard doesn't launch?
Make sure you have your project open in Android (top view) on the left), and not Project. Also check that the correct application module is selected in the drop-down list at the top if you have a project with multiple modules. Sometimes Invalidate Caches / Restart helps.
Do you need to add an icon for Android TV?
If your application supports TVs, be sure to add a banner (Banner) sized 320x180 pixels. This is done through the attribute android:banner in the manifest. Without it, the application will not appear in the Android TV interface, even if it is technically compatible.