9

I have created an Android app with its own launcher icon. It worked well with Nougat. But with Oreo, my icon is replaced by the default Android icon. I have defined ic_launcher.png and ic_launcher_round.png in the mipmap resources for several densities.

My manifest contains the following line:

android:roundIcon="@mipmap/ic_launcher_round"

What should I do to make my own icon appear on Oreo ?

Arnold Schrijver
  • 3,588
  • 3
  • 36
  • 65
Laurent D.
  • 449
  • 4
  • 19

3 Answers3

20

For API 26+ default Android application template defines another icon resource folder

mipmap-anydpi-v26

That folder (usually) contains two xml files ic_launcher and ic_launcher_round that match icon resources declared in manifest for API 26+

Content of those files looks like following:

<?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/ic_launcher_foreground"/>
</adaptive-icon>

In order to have your icon you also need to change all drawables (in all density buckets) listed there - namely ic_launcher_background and ic_launcher_foreground

Or you can just delete that folder, in which case android will fallback to using your png icons, but they will not appear as-is and will be commonly drawn on top of white background.

You can read more at: Adaptive icons

Dalija Prasnikar
  • 27,212
  • 44
  • 82
  • 159
  • 1
    Thanks Dalija. I did not notice this mipmap-anydpi-v26 folder. I have just removed it, and it works fine now on Oreo. I will check later what I can really do with this "adaptive-icon". – Laurent D. Jul 14 '18 at 10:00
  • 1
    @VadimKotov I added link for Adaptive icons. Default template and its content in Android Studio is not documented AFAIK. – Dalija Prasnikar Aug 05 '19 at 14:43
10

Best solution is delete mipmap-anydpi-v26 folder then app will take default icon. In android studio Project mode go to this package

res/mipmap-anydpi-v26

delete it and rebuild and Run Project.

sasikumar
  • 12,540
  • 3
  • 28
  • 48
0

My solution: check res/mipmap-anydpi-v26 folder, then you will see ic_launcher.xml and ic_launcher_round.xml files edit these xml files to point to the actual png file you want to use:

If such png file is not available inside the drawable folder, add it.

That solves the issue.

James Idowu
  • 223
  • 3
  • 4