Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Studio 3.3 disallows adaptive icons for SDK version less than 26

Just upgraded from Android Studio 3.2.1 to 3.3. Previously my project - targeting SDK v28 - built without problems, now I get this build error:

  • What went wrong: Execution failed for task ':app:processDebugResources'.

    Android resource linking failed C:\app\src\main\res\mipmap-anydpi-v25\ic_launcher_round.xml: error: <adaptive-icon> elements require a sdk version of at least 26.
    error: failed linking file resources.

Obviously, I have an <adaptive-icon> resource in the mipmap-anydpi-v25 folder.

So, which AS version handles this correctly; 3.2.1 or 3.3? Should I remove my v25 icon? I thought Lollipop had support for this type of icons...

like image 574
l33t Avatar asked Jan 14 '19 20:01

l33t


3 Answers

which AS version handles this correctly; 3.2.1 or 3.3?

Presumably 3.3, since adaptive icons were added in Android 8.0 (API Level 26).

Should I remove my v25 icon?

Change the directory to mipmap-anydpi-v26/, and you can still use that icon for Android 8.0+. If your minSdkVersion is below that (and I assume that it is), you will need an alternative implementation of the icon for the older devices.

I thought Lollipop had support for this type of icons...

Lollipop is Android 5.x, API Level 21-22. Your -v25 directory would not be used for those API levels.

like image 90
CommonsWare Avatar answered Sep 19 '22 14:09

CommonsWare


For me, in AS 3.4, I had to:

Android Studio: File | Project Structure

enter image description here

It did not work for me to be able use add New | Image Asset due to the Adaptive Icons UNTIL I did that final step of remove SDK 25 from the list even after trying to correctly select the Project SDK and the Build Target.

I had tried several things and this was the final step that made it work for me. I don't know if this is particular to something in my configuration, but this got me past it.

like image 26
tommycox Avatar answered Sep 20 '22 14:09

tommycox


I had the same problem, the reason was I messed up with the files manually but I didn't notice it until the update. In my case, after update to AS 3.3, the files in conflict were:

  • drawable/ic_launcher_background.xml
  • drawable-v24/ic_launcher_foreground.xml

Although AS builds with without errors by changeing the min sdk "minSdkVersion 26" on app/build.gradle, it isn't practical for publishing purposes. the easy quick solution was:

  • create a blank new project
  • copy the exact same files
  • and replace them in the conflicted project
like image 25
Cristián Avatar answered Sep 19 '22 14:09

Cristián