1

I have this code in my Manifest file. The problem that I'm facing is that the icon is being displayed only in Android Lollipop (Api21, Asus Nexus Tab). I've tested in Oreo (Oppo A3S)and Android P (Samsung Galaxy S10+) but the icon is not being displayed. The images in the mipmap look fine though.

 <application
        android:name=".Application"
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/AppTheme"
        tools:ignore="GoogleAppIndexingWarning">

Only a solid color (the background of the icon) is being displayed. Does this have something to do with the images in mipmap? because they look fine. Even the preview of the icon near the line numbers in the manifest looks fine.

I also observed that I just have a webp file in my mipmap-anydpi-v26 but other apps have 2 XML files, one for round and a normal one.

Anirudh Ganesh
  • 446
  • 4
  • 22
  • Does this answer your question? [Legacy icon does not show when using adaptive icon](https://stackoverflow.com/questions/44445305/legacy-icon-does-not-show-when-using-adaptive-icon) – Ivar Jul 21 '20 at 19:01
  • No. I do have mipmap-anydpi-v26, but It doesn't have the XML files. It just has the webp file. I think I'll try deleting the mipmap files and regenerate them again – Anirudh Ganesh Jul 21 '20 at 19:10

2 Answers2

1

You should add the launcher icon the right way. First delete all your ic_launcher and all its versions from mipmap. Now create new image asset with icon type as launcher icon(legacy only) or (adaptive and legacy). Then name it ic_launcher and select your image path and set padding, color, etc then next and finish. It will automatically take the asset as launcher icon in manifest. If not set it manually.

android:icon="@mipmap/ic_launcher"
android:roundIcon="@mipmap/ic_launcher_round"
Rajnish Sharma
  • 390
  • 2
  • 14
  • So I looked for the code of both the XML files and found that they include tags along with a background and foreground tag. Each of the tags take reference from the drawable. So I already had the launcher_foreground and launcher_background in the drawable folder. But I also have a unity library imported inside my project and it also has mipmap folders, due to which I'm now getting a unity icon and not the intended one. I'm thinking of deleting those mipmaps and give it a try. Else, I'd go ahead and delete the mip maps and would regenerate the files. – Anirudh Ganesh Jul 21 '20 at 19:50
0

Apparently, it was because of the missing XML files inside mipmap-anydpi-v26. I had both the XML files inside drawable.

Looked up for similar files in other projects and came to know that both the XML files basically contain tag followed by background and foreground tags inside it.

The attributes of these two tags basically refer to the files in the drawable folder. most probably background would be a layout resource file with tag inside it representing the background color for the icon and the foreground would be a vector.

But deleting all the mipmaps and regenerating them according to https://developer.android.com/studio/write/image-asset-studio#create-notification should also work.

Anirudh Ganesh
  • 446
  • 4
  • 22