Adaptive Icon does not work

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

in the folder mipmap-anydpi-v26I 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 am using Android version 3.0

but the end result is that I got the android icon by default, and not the one I provided.

I also tried putting the foreground png in all the density folders (mipmap-xhdpi, etc.), although I used the same png for everyone when I did it just for testing

+6
source share
3 answers

The responsive icon required by API 26, so you need to upgrade buildtools to at least version 26.0.0

+5
source

, <ImageView>. , :

Caused by: java.lang.IllegalArgumentException: Path string cannot be empty.

, ic_launcher_foreground.xml <path> android:pathData.

<path> !

0

ic_launcher.xml should look like this

<?xml version="1.0" encoding="utf-8"?>
<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>
-2
source

All Articles