简体   繁体   中英

Can't change icon for my android app

Firstly, I copied some icon to mipmap (named ic_launcher.png) - Didn't work.

Second I right clicked res>new>image asset - Didn't work too.

My manifest.xml code is as.

 <application
    android:name=".BlogI"
    android:allowBackup="true"
    android:icon="@mipmap/applicationicon"  // This even shows the right icon in right corner along with the line numbers
    android:label="@string/app_name"
    ......
    ......

I tried clean project and rerun, restarted my android studio(even my PC) also restarted my android device. But, none of the above worked. Before asking this question I tried other similar questions but none helped. Like this one.

If there are any alternatives them please do suggest ! Thanks!

When you generate image asset, delete ic_launcher.xml but keep the png files. xml file has ic_launcher_foreground attribute that overrides default android launcher icon.

First paste your image in drawable then add following code in manifest.xml

 <application
        android:name=".BlogI"
        android:allowBackup="true"
        android:icon="@drawable/your_Image"
        android:label="@string/app_name">`

It worked for me.

I finally found out the fix! It was my 3rd party launcher (Evie Launcher) that didn't update the icons. The icons worked fine on all the devices here on including mine after I changed my launcher.

Thanks for all the suggestions and answers.

Finally found the mistake I was doing from long time.

Just make sure that in AndroidMainfest.xml you have set both properties - android:icon and android:roundIcon appropriately

<application
    android:icon="@mipmap/app_icon"
    android:roundIcon="@mipmap/app_icon".../>

I was just setting android:icon and kept android:roundIcon unchanged.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM