Dinorah Tovar
Dinorah Tovar

Reputation: 311

App Icon Launcher not showing in Android 7.1.1

We are implementing a round icon (with a foreground and a background) and icon.

<application
    android:allowBackup="false"
    tools:replace="android:allowBackup"
    android:label="@string/app_name"
    android:supportsRtl="true"
    android:icon="@mipmap/logo" //normal logo
    android:roundIcon="@mipmap/logo_o" //Our logo with foreground and background
    android:name=".MyApplication"/>

Works for every version but not for API 25

enter image description here

Our code for Foreground with Background is the next one

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

Upvotes: 8

Views: 5767

Answers (7)

Kuldeep Rathee
Kuldeep Rathee

Reputation: 290

You can generate rounded icon with image asset in Android studio For any API . For example in your case you have to generate it for API >=25.

Upvotes: 0

Luciano
Luciano

Reputation: 2798

Reason:

Android has support for adaptive icons on Android 8.0 (API level 26) and above. For more info check the following documentation. It looks like you didn't provide fallback images for devices on API level 25 and below.

How to solve:

Use adaptive icons only on API 26 and above and provide png's images of your app icon for older devices.

Your folder structure should be:

+-- _mipmap-anydpi-v26
|   +-- ic_launcher_round.xml
|   +-- ic_launcher.xml
+-- mipmap-mdpi
|   +-- ic_launcher_round.png
|   +-- ic_launcher.png
+-- mipmap-hdpi
|   +-- ic_launcher_round.png
|   +-- ic_launcher.png
+-- mipmap-xhdpi
|   +-- ic_launcher_round.png
|   +-- ic_launcher.png
+-- mipmap-xxhdpi
|   +-- ic_launcher_round.png
|   +-- ic_launcher.png
+-- mipmap-xxxhdpi
|   +-- ic_launcher_round.png
|   +-- ic_launcher.png

And configure them in your manifest as:

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

The same content can be used for ic_launcher_round.xml and ic_launcher.xml because they are shaped by the OS. For example:

<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
    <background android:drawable="@drawable/ic_launcher_background" />
    <foreground android:drawable="@drawable/ic_launcher_foreground" />
</adaptive-icon>

The png images ic_launcher_round.png and ic_launcher.png should contain the foreground and background layer in a single png and be shaped to the default and the round version of your app icon.

Upvotes: 4

JonasOliveira
JonasOliveira

Reputation: 704

I've solved it by removing the mipmap-anydpi-v25 folder.

Generating the icons again on the newest version of Android Studio I've noticed that Android Studio doesn't generate the v25 folder, so I deleted it and it worked! :)

Upvotes: 0

Funny Story
Funny Story

Reputation: 11

You should regenerate with image asset in Android studio For API 25, you should generate rounded icon

Upvotes: 0

Cuong Nguyen
Cuong Nguyen

Reputation: 1018

You add other icons:

enter image description here

In manifest:

<application
    android:name=".MiseApplication"
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"`

Upvotes: 0

l33t
l33t

Reputation: 19937

Resource structure:

mipmap-anydpi-v25
   \  ic_launcher_round.xml
mipmap-anydpi-v26
   \  ic_launcher.xml
mipmap-*dpi
   \  ic_launcher.png

AndroidManifest.xml:

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

Add resource redirection for the roundIcon resource so that you are guaranteed to have the v26 adaptive icon on API level 26+:

values-anydpi-v26
   \  drawables.xml

drawables.xml:

<?xml version="1.0" encoding="utf-8"?>
<resources>
  <mipmap name="ic_launcher_round">@mipmap/ic_launcher</mipmap>
</resources>

Upvotes: 3

petrsyn
petrsyn

Reputation: 5116

In my case it was caused by deleting PNG/bitmap versions of round icons.

I kept only the mipmap-anydpi-v26 XML versions of the round icon. And deleted all the round icons in folders such as mipmap-hdpi, mipmap-mdpi, etc. thinking they are useless.

When round versions of PNG bitmaps are deleted it works fine on all Android versions (> 4.0) except Android 7.1 API level 25.

Upvotes: 1

Related Questions