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
I recommend you to create a Android O virtual device from Android Studio Virtual Device Manager for testing adaptive icons. I am also getting same error in Android Studio 2.3.3. Seems like Android Studio 2.3.3 does not support adaptive icon tag. We need to get Android Studio 3.0 for that.
Even docs for Adaptive Icons in Android developer website shows Android Studio 3.0 screenshots
https://developer.android.com/preview/features/adaptive-icons.html
Edit:- I have checked and found out that Adaptive Icon is working fine in app build from Android Studio 2.3.3 irrespective of "Element adaptive-icon must be declared" error.
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>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With