597

How can I set an icon for my Android application?

Peter Mortensen
  • 28,342
  • 21
  • 95
  • 123
V I J E S H
  • 6,764
  • 10
  • 26
  • 37
  • 16
    NOTE, for 2016, simply select "New Image Asset" (find it usually via: right-click on eg. the "mipmap" res item) and then just use the wizard. Start with one large image and it scales it for you. See answer by @Justice below. – Fattie Aug 20 '16 at 22:59
  • 2
    Important tip for transparent BG: http://stackoverflow.com/a/37085828/294884 – Fattie Aug 20 '16 at 23:03
  • I'm suggestion (WebApp) [https://android-material-icon-generator.bitdroid.de](https://android-material-icon-generator.bitdroid.de) – NovaYear Jan 28 '19 at 19:40

17 Answers17

710

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:

<application android:icon="@drawable/icon_name" android:label="@string/app_name" >
.... 
</application> 
aleb
  • 2,440
  • 1
  • 23
  • 43
Liam George Betsworth
  • 17,558
  • 5
  • 37
  • 42
  • 3
    BTW you can use Inkscape to generate png from SVG. With something like: `inkscape %logo_file% -e %output_file% %WIDTH% %HEIGHT% --export-background-opacity=0.0` – Nux Nov 17 '12 at 13:02
  • 31
    You can use a single large icon, though you'll have no control over how the algorithm changes its final appearance. This question has been answered here: http://stackoverflow.com/questions/6695413/android-designing-different-icons-for-screen-densities – Liam George Betsworth May 27 '14 at 15:23
  • 5
    What should the extension be? `.png`? `.ico`? – CodyBugstein Jun 18 '14 at 11:22
  • 11
    imagine how 512 x 512 will be displayed as 36 x 36? program will pick some pixels from 512 x 512, maybe somehow mix them and display as 36 x 36. There sure will be quantization error, e.g., http://en.wikipedia.org/wiki/Aliasing. So sure the 36 x 36 image will not be pixel perfect. – Helin Wang Jun 24 '14 at 05:22
  • @LiamGeorgeBetsworth where exactly did you find those sizes? – aleb Oct 10 '14 at 09:40
  • 7
    @aleb http://developer.android.com/design/style/iconography.html - "So, to create an icon for different densities, you should follow the 2:3:4:6:8 scaling ratio between the five primary densities (medium, high, x-high, xx-high, and xxx-high respectively). For example, consider that the size for a launcher icon is specified to be 48x48 dp. This means the baseline (MDPI) asset is 48x48 px, and the high-density(HDPI) asset should be 1.5x the baseline at 72x72 px, and the x-high density (XHDPI) asset should be 2x the baseline at 96x96 px, and so on." – Liam George Betsworth Oct 10 '14 at 09:46
  • Should the folder that is just called "drawable" with no dpi suffix have a particular sized icon in it? – TheBestBigAl Jan 09 '15 at 10:01
  • @TheBestBigAl Not really. I use the drawable folder for single graphics that span all resolutions. – Liam George Betsworth Jan 09 '15 at 13:02
  • See my comment http://stackoverflow.com/questions/17049732/creating-a-new-icon-set-in-android-studio/34740385#34740385 to let Gradle generate the resource files for you. – Christian Schulzendorff Jan 12 '16 at 10:05
  • See my answer below where you only need to set one image and Android Studio handles the scaling for you. – Ben Sefton Nov 20 '20 at 00:50
278

Add an application launcher icon with automatic sizing.

(Android studio)

Go to menu File* → NewImage Assets → select launcher icon → choose image file.

It will automatically re-size.

Done!

Peter Mortensen
  • 28,342
  • 21
  • 95
  • 123
Arshid KV
  • 8,105
  • 3
  • 27
  • 32
205

I found this tool most useful.

  1. Upload a image.
  2. Download a zip.
  3. Extract into your project.

Done

http://romannurik.github.io/AndroidAssetStudio/

Abdellah Alaoui
  • 4,276
  • 1
  • 22
  • 33
Blowsie
  • 38,136
  • 15
  • 81
  • 108
68

It's better to do this through Android Studio rather than the file browser as it updates all icon files with the correct resolution for each.

To do so go to menu FileNewImage 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.

Enter image description here

Don't forget "Shape - none" for a transparent background.

Please don't edit my answer without asking.

Ben Sefton
  • 818
  • 6
  • 10
  • 1
    For newer versions of android studio, this is the best answer, +1 from me – Angry 84 Mar 10 '17 at 19:33
  • 1
    Updated for 2018, should be first – Ignacio Ara Apr 27 '18 at 10:11
  • This is the best answer, because Android Studio will generate all the right assets with the right names. You can start with a single image asset rather than having to manually generate different assets sizes and then trying to figure out where they go in the latest version of Android Studio. – Fuad Kamal Apr 13 '20 at 21:40
37

Put your images in mipmap folder and set in manifest file... like as

 <application android:icon="@mipmap/icon" android:label="@string/app_name" >
 .... 
 </application>  

App Folder Directory :

enter image description here

Icon Size & Format : enter image description here

Niranj Patel
  • 35,286
  • 11
  • 96
  • 128
32

Place your images in drawables folder under either of the three and set it like this.

Code

<application android:icon="@drawable/your_icon" >
.... 
</application>  
cafebabe1991
  • 4,416
  • 1
  • 25
  • 36
Sunil Pandey
  • 6,836
  • 7
  • 33
  • 48
21

Right click your project, go to New > Other > Android > Android Icon Set

Then follow the instructions on the Wizard

Pratik Butani
  • 51,868
  • 51
  • 228
  • 375
labatyo
  • 488
  • 7
  • 17
  • That option doesn't exist on Android Studio. – The Berga Aug 25 '15 at 22:37
  • 3
    I had to click on a file in the project to expand the breadcrumbs at the top. Then there were different options available when right clicking the project. New > Image Assets – craigq Feb 02 '16 at 18:15
16

1-Create Your icon in Photoshop Or Coreldraw by size 256*256

note that use PNG file format if you want to have a transparent icon

2-Upload Your icon in https://romannurik.github.io/AndroidAssetStudio/icons-launcher.html

3-Set your setting on this site enter image description here

4-Download the zip file automatically created by the webpage by clicking on download button enter image description here

5-Extract the zip file and copy res folder to you project library enter image description here

note that res folder contain all size icon

6-finally you need to set the manifest to use icon

<application android:icon="@drawable/your_icon" >
.... 
</application>
Milaaaad
  • 317
  • 6
  • 13
13

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:

Android studio icons plugin

This is mainly for creating the icons with required sizes, and it will be located directly in its folders.

Peter Mortensen
  • 28,342
  • 21
  • 95
  • 123
Mohamed
  • 741
  • 8
  • 17
7

You can start by reading the documentation.

Here is a link:

How to change the launcher logo of an app in Android Studio?

Community
  • 1
  • 1
trgraglia
  • 5,083
  • 5
  • 42
  • 74
  • 1
    The other two answers are in the link provided. I provided a link because hopefully you will see the good documentation and begin to start there. The answer which tells you to use any of the three folders is right but also wrong. You should provide three different sizes for each of the screen densities. – trgraglia Mar 18 '11 at 13:20
  • http://developer.android.com/guide/practices/ui_guidelines/icon_design.html is another helpful link that talks more about icons. – Louis Sayers Sep 11 '12 at 09:49
  • actung: broken link – Stefano Giacone Jul 31 '16 at 12:58
  • 14
    Downvoted because this is not helpful. "You can start by..." is also needlessly passive aggressive. – daspianist Sep 10 '16 at 19:06
6

You have to follow steps like:

  • You will see your default icons ic_launcher.png like:

enter image description here

  • 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.

enter image description here

  • Now you have to copy all the folders which are in side of res folder,

enter image description here

  • 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.

Happy Coding :) :)

Pratik Butani
  • 51,868
  • 51
  • 228
  • 375
6
  1. Choose icon picture copy this pic
  2. Paste it into your project's res/drawable folder
  3. Open manifest file and set

  4. Run program

Joseph Shanak
  • 981
  • 10
  • 26
Pratik Popat
  • 2,857
  • 17
  • 29
5

If you have an SVG icon, you can use this script to generate your android icon set.

iceman
  • 826
  • 13
  • 24
3

A bit old, but for future use:

Open Android Studio -> app/src/main/res -> Right Click -> Image Asset
sschuberth
  • 23,652
  • 5
  • 80
  • 125
Pavel 'PK' Kaminsky
  • 766
  • 1
  • 9
  • 18
3

Define the icon for android application

<application android:icon="drawable resource">
.... 
</application> 

https://developer.android.com/guide/topics/manifest/application-element.html


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...

enter image description here


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.

enter image description here


Place icon in mipmap or drawable folder

android:icon="@drawable/icon_name" or android:icon="@mipmap/icon_name"

developer.android.com/guide says,

This attribute must be set as a reference to a drawable resource containing the image (for example "@drawable/icon").

about launcher icons android-developers.googleblog.com says,

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.

Dianne Hackborn from Google (Android Framework) says,

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.

For launcher icons, the AndroidManifest.xml file must reference the mipmap/ location

<application android:name="ApplicationTitle"
         android:label="@string/app_label"
         android:icon="@mipmap/ic_launcher" >

Little bit more quoting this

  1. 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.

  2. 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

  1. Android Asset Studio by romannurik.github
  2. Android Asset Studio by jgilfelt.github
  3. Image Asset Studio(from Android Studio)
  4. Material Icon Generator.bitdroid.de
  5. Android Material Design Icon Generator Plugin by github.com/konifar
  6. A script to generate android assets from a SVG file

Read more : https://developer.android.com/guide/practices/ui_guidelines/icon_design_launcher.html

Community
  • 1
  • 1
Charuක
  • 12,229
  • 5
  • 43
  • 83
1

In AndroidManifest change these :

android:icon="@drawable/icon_name"
android:roundIcon="@drawable/icon_name"
Hamed Karami
  • 340
  • 1
  • 3
  • 28
0

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

<application android:icon="@mipmap/your_Icon"> ....</application>
Rushikesh
  • 351
  • 4
  • 4