Invader Zim
Invader Zim

Reputation: 838

ic_launcher.xml not being used as app icon

I'm developing an Android app.

I'm trying to use ic_launcher.xml and ic_launcher_round.xml as app icons as I think that is the proper way?

Anyway, I have one png image, 108x108px, 32bit color. I use it in both ic_launcher and ic_launcher_round as:

<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
    <background android:drawable="@drawable/ic_launcher_background" />
    <foreground android:drawable="@drawable/app_icon" />
</adaptive-icon>

The code is the same for both xml files.

The problem is that on newer os versions (8.0+, round icons) it works well, but on earlier versions it doesn't (7.0, square icons) it doesn't work at all, and defaults to standard android icon.

I'm currently creating all images that I will use to replace ic_launcher.png in mipmaps, but aside from that can I do something else?

In manifest, I use them as:

android:icon="@mipmap/ic_launcher"
android:roundIcon="@mipmap/ic_launcher_round"

Upvotes: 1

Views: 11802

Answers (2)

Shamxal Bayramov
Shamxal Bayramov

Reputation: 49

I recommend you to use at least 512x512 px images to generate launcher icons for app.

there is great online tool to generate launcher icons to fit all screens:

http://romannurik.github.io/AndroidAssetStudio/icons-launcher.html

or you can use Android Studio's default tool to import your image and generate it anyway.

(right click) -> New -> Image Asset

Upvotes: 5

ILLIA DEREVIANKO
ILLIA DEREVIANKO

Reputation: 790

You can customize your app's icon using Android Studio tools.

  1. In the Project window, select the Android view.
  2. Right-click the res folder and select New > Image Asset.

More: https://developer.android.com/studio/write/image-asset-studio

Upvotes: 7

Related Questions