androidkotlinandroid-manifestandroid-iconsandroid-mipmap

App Icon displayed only in API21 but fails in other api's


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.


Solution

  • 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.