If you intend on your application being available on a large range of devices, you should place your application icon into the different res/drawable... folders provided. In each of these folders, you should include a 48dp sized icon:
drawable-ldpi(120 dpi, Low density screen) - 36px x 36px
drawable-mdpi(160 dpi, Medium density screen) - 48px x 48px
drawable-hdpi(240 dpi, High density screen) - 72px x 72px
drawable-xhdpi(320 dpi, Extra-high density screen) - 96px x 96px
drawable-xxhdpi(480 dpi, Extra-extra-high density screen) - 144px x 144px
drawable-xxxhdpi(640 dpi, Extra-extra-extra-high density screen) - 192px x 192px
You may then define the icon in your AndroidManifest.xml file as such:
Now simply go to menu File → New → Image Asset. This will open a new dialogue and then make sure Launcher Icons is selected (Which it is by default) and then browse to the directory of your icon (it doesn't have to be in the project resources) and then once selected make sure other settings are to your liking and hit done.
Now all resolutions are saved into their respective folders, and you don't have to worry about copying it yourself or using tools, etc.
Don't forget "Shape - none" for a transparent background.
You can simply install an Android studio Martial icons plugin its name is please check plugin URL Material Design Icon Generator and check this GIF for more details:
This is mainly for creating the icons with required sizes, and it will be located directly in its folders.
You will see your default icons ic_launcher.png like:
You have to change all the images which are in mipmap-xxxx folders.
First of you have to create your own logo or pick up image that you want to place as icon of launcher and upload here Android Asset Studio - Icon Generator - Launcher icons, You will get all the set of mipmap-xxxx and web_icon also from that link.
Now you have to copy all the folders which are in side of res folder,
Now go to Android Studio Project -> Right click on res folder -> Paste. It will prompt you like File 'ic_launcher.png' already exists in directory, You can press Overwrite all. It will paste/replace images in respective folder.
Now you can run and see your application icon with new image.
If your app available across large range of devices
You should create separate icons for all generalized screen densities,
including low-, medium-, high-, and extra-high-density screens. This
ensures that your icons will display properly across the range of
devices on which your application can be installed...
Size & Format
Launcher icons should be 32-bit PNGs with an alpha channel for
transparency. The finished launcher icon dimensions corresponding to a
given generalized screen density are shown in the table below.
Place icon in mipmap or drawable folder
android:icon="@drawable/icon_name" or android:icon="@mipmap/icon_name"
It’s best practice to place your app icons in mipmap- folders (not the
drawable- folders) because they are used at resolutions different from
the device’s current density. For example, an xxxhdpi app icon can be
used on the launcher for an xxhdpi device.
If you are building different versions of your app for different
densities, you should know about the "mipmap" resource directory.
This is exactly like "drawable" resources, except it does not
participate in density stripping when creating the different apk
targets.
You want to load an image for your device density and you are going to use it "as is", without changing its actual size. In this case you should work with drawables and Android will give you the best fitting image.
You want to load an image for your device density, but this image is going to be scaled up or down. For instance this is needed when you want to show a bigger launcher icon, or you have an animation, which increases image's size. In such cases, to ensure best image quality, you should put your image into mipmap folder. What Android will do is, it will try to pick up the image from a higher density bucket instead of scaling it up. This will increase sharpness (quality) of the image.
If you intend on your application being available on a large range of devices, you should place your application icon into the different
res/drawable...
folders provided. In each of these folders, you should include a 48dp sized icon:drawable-ldpi
(120 dpi, Low density screen) - 36px x 36pxdrawable-mdpi
(160 dpi, Medium density screen) - 48px x 48pxdrawable-hdpi
(240 dpi, High density screen) - 72px x 72pxdrawable-xhdpi
(320 dpi, Extra-high density screen) - 96px x 96pxdrawable-xxhdpi
(480 dpi, Extra-extra-high density screen) - 144px x 144pxdrawable-xxxhdpi
(640 dpi, Extra-extra-extra-high density screen) - 192px x 192pxYou may then define the icon in your
AndroidManifest.xml
file as such:I found this tool most useful.
Done
http://romannurik.github.io/AndroidAssetStudio/
Add an application launcher icon with automatic sizing.
(Android studio)
Go to menu File* → New → Image Assets → select launcher icon → choose image file.
It will automatically re-size.
Done!
It's simple.
Now simply go to menu File → New → Image Asset. This will open a new dialogue and then make sure Launcher Icons is selected (Which it is by default) and then browse to the directory of your icon (it doesn't have to be in the project resources) and then once selected make sure other settings are to your liking and hit done.
Now all resolutions are saved into their respective folders, and you don't have to worry about copying it yourself or using tools, etc.
Don't forget "Shape - none" for a transparent background.
Put your images in
mipmap
folder and set in manifest file... like asApp Folder Directory :
Icon Size & Format :
Place your images in drawables folder under either of the three and set it like this.
Code
Right click your project, go to New > Other > Android > Android Icon Set
Then follow the instructions on the Wizard
1-Create Your icon in Photoshop Or Coreldraw by size 256*256
2-Upload Your icon in https://romannurik.github.io/AndroidAssetStudio/icons-launcher.html
3-Set your setting on this site
4-Download the zip file automatically created by the webpage by clicking on download button
5-Extract the zip file and copy res folder to you project library
6-finally you need to set the manifest to use icon
You can start by reading the documentation.
Here is a link:
How to change the launcher logo of an app in Android Studio?
You can simply install an Android studio Martial icons plugin its name is please check plugin URL Material Design Icon Generator and check this GIF for more details:
This is mainly for creating the icons with required sizes, and it will be located directly in its folders.
res/drawable
folderOpen manifest file and set
Run program
You have to follow steps like:
ic_launcher.png
like:Now you can run and see your application icon with new image.
Happy Coding :) :)
If you have an SVG icon, you can use this script to generate your android icon set.
A bit old, but for future use:
Define the icon for android application
https://developer.android.com/guide/topics/manifest/application-element.html
If your app available across large range of devices
Size & Format
Place icon in mipmap or drawable folder
android:icon="@drawable/icon_name"
orandroid:icon="@mipmap/icon_name"
developer.android.com/guide says,
about launcher icons android-developers.googleblog.com says,
Dianne Hackborn from Google (Android Framework) says,
For launcher icons, the AndroidManifest.xml file must reference the mipmap/ location
Little bit more quoting this
You want to load an image for your device density and you are going to use it "as is", without changing its actual size. In this case you should work with drawables and Android will give you the best fitting image.
You want to load an image for your device density, but this image is going to be scaled up or down. For instance this is needed when you want to show a bigger launcher icon, or you have an animation, which increases image's size. In such cases, to ensure best image quality, you should put your image into mipmap folder. What Android will do is, it will try to pick up the image from a higher density bucket instead of scaling it up. This will increase sharpness (quality) of the image.
Fore more you can read mipmap vs drawable folders
Tools to easily generate assets
Read more : https://developer.android.com/guide/practices/ui_guidelines/icon_design_launcher.html
Goto File->new->ImageAsset.
From their you can create Image Assets for your icon.
After that we will get icon image in mipmap different formats like hdpi,mdpi,xhdpi,xxhdpi,xxxhdpi.
Now goto AndroidManifest.xml