Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adaptive Icon not working

manifest:

<application
    android:name="..."
    android:allowBackup="false"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/MyTheme"
    tools:replace="icon,label,theme,name,allowBackup">

under the folder mipmap-anydpi-v26 I have defined ic_launcher.xml:

<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
   <background android:drawable="@color/white"/>
   <foreground android:drawable="@mipmap/ic_launcher_foreground"/>
</adaptive-icon>

here is my folder structure : enter image description here

build.gradle:

compileSdkVersion = 26
buildToolsVersion = "25.0.2"
supportLibVersion = "25.3.1"
targetSdkVersion = 25
minSdkVersion = 18

AND, I'm using android studio 3.0

but the end result is that I get a default android icon instead of the one I provided.

I've also tried putting the foreground png in all of the density folders (mipmap-xhdpi, etc), although I used the same png for all when I did this just for testing

like image 849
Siavash Avatar asked Oct 18 '17 18:10

Siavash


People also ask

How do I enable adaptive icons support?

Setting Adaptive Icons in Nova LauncherEnter the Nova Launcher Settings by holding a long press on your Nova home screen, and then selecting the gear icon. Now, tap on the “Look & Feel” tab, and aside from all the standard sections, you will notice the “Adaptive Icons” option.

How do I set adaptive icon?

Go to Android standalone settings, choose "adaptive" icon type, and then select the path to the "res" folder above: 13. Deploy to your Android device.

How do I get rid of adaptive icon on Android?

Go to "Background" and toggle off the Shape to get an icon with no background. Go to "Logo", then "Design, then change the "Type" to "Not adaptive" and change "Compositing" to "Overwrite".

What is adaptive app icon?

An adaptive icon, or AdaptiveIconDrawable , can display differently depending on individual device capabilities and user theming. Adaptive icons are primarily used by the launcher on the homescreen, but can also be used in shortcuts, the Settings app, sharing dialogs, and the overview screen.


2 Answers

Adaptive icon requied API 26 so you need to update your buildtools to at least 26.0.0 version

like image 67
Karol Kulbaka Avatar answered Nov 04 '22 21:11

Karol Kulbaka


I too have faced the same issue, here is how I have fixed this issue

  1. Right click on resource -> New -> ImageAsset

  2. Choose the ic_launcher_background icon and ic_launcher_foreground as shown in below screen

enter image description here

  1. Android studio creates an ic_launcher.xml under resource mipmap (anydpi-v26)

     <?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>
    
  2. Now inside the Manifest.XML, declare the icon and round icon something shown in like below

    <application
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:roundIcon="@mipmap/ic_launcher"
    android:supportsRtl="true"
    android:theme="@style/AppTheme">
    
    
                    .......</application>
    

    Yes that's all and Run your app on any device it appears

like image 28
Suresh Maidaragi Avatar answered Nov 04 '22 22:11

Suresh Maidaragi