Get rid of an old application icon on new Android

Viewed 126

Some time ago I made a simple Android application - a shared intent handler that uploads data.

Now I designed a new SVG-icon for it, imported in project as vector graphic, then converted with InkScape to a series of PNGs and replaced all the PNGs in the project.

The application is now shown with the new icon on

  • Android 4.3 (SGS3, Stock firmware)
  • and Android 7.1 (SGS2, LineageOS)

but Android 11 (API level 30, Samsung Galaxy A50, stock firmware) shows still the old icon.

There are no more places left in application where the default icon (green android head with ears) could reside!!!

May be the default icon is shown when some expected resource is simply missing?

I replaced image with the new one in following files:

  • app\src\main\res\drawable-v24\ic_launcher_foreground.xml
  • app\src\main\res\mipmap-hdpi\ic_launcher.png
  • app\src\main\res\mipmap-mdpi\ic_launcher.png
  • app\src\main\res\mipmap-xhdpi\ic_launcher.png
  • app\src\main\res\mipmap-xxhdpi\ic_launcher.png
  • app\src\main\res\mipmap-xxxhdpi\ic_launcher.png
  • app\src\main\res\mipmap-hdpi\ic_launcher_round.png
  • app\src\main\res\mipmap-mdpi\ic_launcher_round.png
  • app\src\main\res\mipmap-xhdpi\ic_launcher_round.png
  • app\src\main\res\mipmap-xxhdpi\ic_launcher_round.png
  • app\src\main\res\mipmap-xxxhdpi\ic_launcher_round.png

I noticed that there is no ic_launcher_foreground.xml in app\src\main\res\drawable\ folder, only in app\src\main\res\drawable-v24\. Is this normal?

My app\src\main\res\mipmap-anydpi-v26\ic_launcher.xml file looks like:

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

and when I Ctrl-click on @drawable/ic_launcher_foreground in Android Studio, it leads me to app\src\main\res\drawable-v24\ic_launcher_foreground.xml.

2 Answers

You should try adding icons from

res -> drawable -> right click -> new -> add image asset -> launcher icon

Change your launcher icon there and it should be visible properly and everywhere.

Try changing your ic_launcher.xml file from

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

to

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

adaptive-icon is only used on Android 8 (SDK 26) and up, so your device running Android 11 is referencing this file and the devices running older versions of Android are not.

Related