13

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

l33t
  • 18,692
  • 16
  • 103
  • 180

6 Answers6

9

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.

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
  • 1
    Looks like I managed to fool the compiler in 3.2. Had some resource redirection as described [here](https://stackoverflow.com/a/53200120/419761). – l33t Jan 14 '19 at 21:03
  • 1
    @l33t: It is possible that the OS had undocumented support for ``. Either that, or AS 3.2 somewhat ignored your instructions and generated something that worked without trying to foist an adaptive icon on Android 7.1. Since there's no documented support for `` for Android 7.1 and older, what AS 3.3 is forcing you to do should reduce the likelihood of some device choking on the unexpected resource type. – CommonsWare Jan 14 '19 at 21:10
4

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.

tommycox
  • 108
  • 8
1

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
Cristián
  • 21
  • 1
1

Here is how i fixed it.

  1. File -> Project Structure
  2. Select Modules
  3. Change compile SDK to above API 26 (optional i think)
  4. Select tab Default Config and change target SDK version to above API 26
rsharma
  • 169
  • 1
  • 10
0

It shows an error when you have APIs less than 26 in SDK.

To remove Older APIs from SDK:

  1. Click on File.
  2. Select Project Structure.
  3. Select SDKs inside Platform Setting.
  4. In right side check if is there any older APIs showing then API 26.
  5. Select Older APIs and click on Delete (-) Button.

Remove all older APIs than API 26. Click on Apply and ok.

It will work :)

shroffakshar
  • 317
  • 2
  • 5
0

Don't Waste your Time on minimum SDK version 21 to 26: Just follow these simple steps:

  • Just Export Your Logo in Transparent SVG format.

  • Transparent means only the logo identity part without a background.

  • Import this logo in the android @drawable folder as vector SVG.

  • In the Notification Channel that you are using to make status notifications!

      val builder = NotificationCompat.Builder(context, "FIRE_BASE_NOTIFICATION")
     .setSmallIcon(R.drawable.transparent_logo)
     .setColor(ContextCompat.getColor(context, R.color.colorPrimary))
    

    Set SmallIcon and set Background Color of your Logo.

In Android 11+ even if you add a full-color logo it will automatically convert it into a single plain color, If you do not set the background color then it will show a grey-filled circle. That will hide your identity. Thanks Get rid of this problem as adaptive icons were introduced in Android 8.0 (API level 26)