Andrew
Andrew

Reputation: 1

I can't set an icon for my app in Android Studio

So I imported all the images with the app icon in the mipmap folder and I deleted the round icon folder since I don't need/use any round icons for my app. Then, in the AndroidManifest.xml file I deleted the android:roundIcon="@mipmap/ic_launcher_round"(again, I don't need/use round icons, that's why I deleted this line of code). And that's it, this is how I have been tought to add icons to an app, but when I test this in the Android Studio Virtual Machine, I still get the Android face icon, and I don't know why.. Any help?

This is the Icon I should get

enter image description here

This is my AndroidManifest.xml file

enter image description here

This is the Icon I get (The FunFacts1 app!)

enter image description here

Upvotes: 0

Views: 2371

Answers (5)

HB.
HB.

Reputation: 4226

Okay, after some testing and research, I found the answer.

If you are targeting 26> (which you will have to do because of the new requirements from the end of the month) your icon will be round, or it will have a round (container) around the icon.

Here is a discussion about this.


I would also advise you to look at adaptive icons, which will now be the required way of setting icons.

By using adaptive icons you can set the background and foreground of your icons and set the shape for different devices:

enter image description here

The answer by @InsaneCat is correct, but it will be deprecated by the end of the month.

You will now have to create adaptive and legacy launcher icons, you can read more about this here.


Last point, which is the most important - always refer to the official documentation as a lot of answers are deprecated and everyone answers just to get reputation points.

Upvotes: 2

Vishal Sharma
Vishal Sharma

Reputation: 1061

In both places put the same image path:

android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher"

if another image you will use so simple paste on mipmap folder

Upvotes: 0

PaulP1
PaulP1

Reputation: 125

Okay so I actually found another way... In Android Studio, right click on the app folder and select New-->Image Asset and there click the 3 button next to Path section and there drag and drop your image.

Upvotes: 0

InsaneCat
InsaneCat

Reputation: 2161

Add below code into your manifest:

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

and put ic_launcher in all folders according to icon size

mipmap-ldpi (120 dpi, Low density screen) - 36px x 36px
mipmap-mdpi (160 dpi, Medium density screen) - 48px x 48px
mipmap-hdpi (240 dpi, High density screen) - 72px x 72px
mipmap-xhdpi (320 dpi, Extra-high density screen) - 96px x 96px
mipmap-xxhdpi (480 dpi, Extra-extra-high density screen) - 144px x 144px
mipmap-xxxhdpi (640 dpi, Extra-extra-extra-high density screen) - 192px x 192px

Hope this may help you

Upvotes: 1

Shubham Sejpal
Shubham Sejpal

Reputation: 3614

Add this line in you AndroidMmanifest.xml and than try to run it again and what happens.

android:roundIcon="@mipmap/ic_launcher"

Upvotes: 0

Related Questions