Element adaptive-icon must be declared

Viewed 7519

I use Android Studio 2.3.3 stable and trying to create adaptive icon for Android O

I've created folder mipmap-anydpi-v26 and file ic_launcher.xml with following content

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

But it says "Element adaptive-icon must be declared". Target SDK and build tools are both set to 26.

It builds successfully, but I don't have any device to test it, so my question is - does it works?

P.S.: Foreground is valid VectorDrawable

2 Answers

ic_launcher.xml should be 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>
Related