Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AppIcon not displayed for Android 7 #23178

Open
Syed-RI opened this issue Jun 21, 2024 · 17 comments · May be fixed by #23276
Open

AppIcon not displayed for Android 7 #23178

Syed-RI opened this issue Jun 21, 2024 · 17 comments · May be fixed by #23276
Assignees
Labels
area-single-project Splash Screen, Multi-Targeting, MauiFont, MauiImage, MauiAsset, Resizetizer platform/android 🤖 s/triaged Issue has been reviewed s/verified Verified / Reproducible Issue ready for Engineering Triage t/bug Something isn't working
Milestone

Comments

@Syed-RI
Copy link

Syed-RI commented Jun 21, 2024

Description

App icon in the launcher and task switcher is not displaying for Android 7. However, Android 8 and up works
Task_Switcher_Android8
AppIcon_Android8
Task_Switcher_Android7
AppIcon_Android7 png

Steps to Reproduce

Create a new maui app and deploy to an emulator running Android 7 (7.1.1) with a screen resolution of 1280 x 720. Or build and deploy the repro attached to same emulator.

Link to public reproduction project repository

https://github.com/Syed-RI/DeployTest

Version with bug

8.0.60 SR6

Is this a regression from previous behavior?

Not sure, did not test other versions

Last version that worked well

Unknown/Other

Affected platforms

Android

Affected platform versions

Android 7.1.1

Did you find any workaround?

Works on Android 8 and up

Relevant log output

No response

@Syed-RI Syed-RI added the t/bug Something isn't working label Jun 21, 2024
Copy link
Contributor

Hi I'm an AI powered bot that finds similar issues based off the issue title.

Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one and thumbs upping the other issue to help us prioritize it. Thank you!

Closed similar issues:

Note: You can give me feedback by thumbs upping or thumbs downing this comment.

@Equabyte
Copy link

Equabyte commented Jun 21, 2024

@Syed-RI I have an app in production compiled with 8.0.60 SR6 that is tested on physical devices with all supported Android versions including Android 7 and the app icon is showing correctly (despite its look not being the same as in latest Android versions). Image below is from a Samsung A3 2016 running Android 7 (last Android version supported on that device). So the issue you describe seems either device-specific or emulator related.

DCF_Calc_Android_7

@Syed-RI
Copy link
Author

Syed-RI commented Jun 21, 2024

It happens on physical device as well. I think it is probably related to the screen resolution mine was 1280 x 720.Screenshot_20240621_180723_Jira.png

@Equabyte
Copy link

It happens on physical device as well. I think it is probably related to the screen resolution mine was 1280 x 720.

Galaxy A3 (2016) is also 720 x 1280 so it does not seem to be the resolution.

@Equabyte
Copy link

And here's your icon on my Galaxy A3 (2016) running Android 7:

deploy_test_icon

@Syed-RI
Copy link
Author

Syed-RI commented Jun 21, 2024

And here's your icon on my Galaxy A3 (2016) running Android 7:

deploy_test_icon

Plot thickens

@Equabyte
Copy link

Plot thickens

There is a caveat though: Samsung Android 7 devices use an icon container by default (visible in my image) which may hide the true issue you are facing on your device/emulator. So indeed worth checking further in case Android 7 is really important to you; but according to this chart the share of Nougat users is now less than 1.5% worldwide.

@Zhanglirong-Winnie Zhanglirong-Winnie added s/verified Verified / Reproducible Issue ready for Engineering Triage s/triaged Issue has been reviewed labels Jun 24, 2024
@Zhanglirong-Winnie
Copy link
Collaborator

This issue has been verified using Visual Studio 17.11.0 Preview 2.1 (8.0.60 & 8.0.40 & 8.0.10). Can be reproduced on Android(7.1 &1280 x 720)platform.
image

@Syed-RI
Copy link
Author

Syed-RI commented Jun 24, 2024

There is a caveat though: Samsung Android 7 devices use an icon container by default (visible in my image) which may hide the true issue you are facing on your device/emulator. So indeed worth checking further in case Android 7 is really important to you; but according to this chart the share of Nougat users is now less than 1.5% worldwide.

This is for an enterprise app and we are committed to provide support for Android 7 and up. Besides, MAUI SDK itself supports Android 7 and up therefore I think this should be looked at. Probably needs a Resizetizer tweak? cc @mattleibow @Redth

@mattleibow mattleibow self-assigned this Jun 25, 2024
@mattleibow
Copy link
Member

I'll have a look. This is very weird as we have not really changed anything and there should be a drawable fallback.

@mattleibow mattleibow added this to the Backlog milestone Jun 25, 2024
@mattleibow
Copy link
Member

OK, I managed to repro it... Not sure the issue yet as the images are there and the image works for Android 6.0.

I typically test Android 6, 9, 10, 13, 14 since they are on borders of major OS changes. They all work on those I believe, so Android 7 is giving us gifts of joy it seems.

@mattleibow
Copy link
Member

I had a look and I see why this is happening:

This means that specifically for Android 7, the round icons are PNG files but for Android 8 they are adaptive icons.

So, the first workaround is to just drop round icons altogether. This means you will lose round icons on all Android versions, but just involves deleting the android:roundIcon="@mipmap/appicon_round" from your Platforms/Android/AndroidManifest.xml

If you still want round icons for new Android versions and maybe less concerned with the Android 7 app icon adherence to the "round" design, you could copy the generated icons from obj/Debug/net8.0-android/resizetizer/r/mipmap-*/appicon.png and add them to Platforms/Android/Resources/mipmap-*/appicon_round.png. Then in your csproj, you can add them as Android-specific resources: <AndroidResource Include="Platforms\Android\Resources\mipmap-*\*" />

This will just be a copy of the "legacy" icons and pretend they are round. But, if that is not viable, then you can potentially generate the round ones using a graphics program and place them in the same location. As long as you name it all the same as the other icons, they will just work together.

As soon as I have a fix for generating legacy round icons, I will link to it.

@Syed-RI
Copy link
Author

Syed-RI commented Jun 25, 2024

I had a look and I see why this is happening:

This means that specifically for Android 7, the round icons are PNG files but for Android 8 they are adaptive icons.

So, the first workaround is to just drop round icons altogether. This means you will lose round icons on all Android versions, but just involves deleting the android:roundIcon="@mipmap/appicon_round" from your Platforms/Android/AndroidManifest.xml

If you still want round icons for new Android versions and maybe less concerned with the Android 7 app icon adherence to the "round" design, you could copy the generated icons from obj/Debug/net8.0-android/resizetizer/r/mipmap-*/appicon.png and add them to Platforms/Android/Resources/mipmap-*/appicon_round.png. Then in your csproj, you can add them as Android-specific resources: <AndroidResource Include="Platforms\Android\Resources\mipmap-*\*" />

This will just be a copy of the "legacy" icons and pretend they are round. But, if that is not viable, then you can potentially generate the round ones using a graphics program and place them in the same location. As long as you name it all the same as the other icons, they will just work together.

As soon as I have a fix for generating legacy round icons, I will link to it.

Awesome Matt!

We can live without the round icons so I'll look into it tomorrow. But IIRC, I have tried copying and pasting from resizetizer output and that broke the build as on next build resizetizer complained about same assets (i.e. appicon.png) being present in the dir.

@mattleibow
Copy link
Member

resizetizer complained about same assets

Yeah, make sure to copy the appicon and rename to appicon_round. You will just need those variants as all the others are still generated.

@mattleibow mattleibow linked a pull request Jun 26, 2024 that will close this issue
@mattleibow
Copy link
Member

This PR has the fixes to generate round icons for Android 7 #23276

@mattleibow
Copy link
Member

/similarissues

Copy link
Contributor

Hi I'm an AI powered bot that finds similar issues based off the issue title.

Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one and thumbs upping the other issue to help us prioritize it. Thank you!

Closed similar issues:

Note: You can give me feedback by thumbs upping or thumbs downing this comment.

@PureWeen PureWeen added the area-single-project Splash Screen, Multi-Targeting, MauiFont, MauiImage, MauiAsset, Resizetizer label Jun 28, 2024
@samhouts samhouts removed s/verified Verified / Reproducible Issue ready for Engineering Triage s/triaged Issue has been reviewed labels Jul 3, 2024
@samhouts samhouts added the s/verified Verified / Reproducible Issue ready for Engineering Triage label Jul 10, 2024
@samhouts samhouts added the s/triaged Issue has been reviewed label Jul 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-single-project Splash Screen, Multi-Targeting, MauiFont, MauiImage, MauiAsset, Resizetizer platform/android 🤖 s/triaged Issue has been reviewed s/verified Verified / Reproducible Issue ready for Engineering Triage t/bug Something isn't working
Projects
Status: Todo
Development

Successfully merging a pull request may close this issue.

7 participants