maui icon indicating copy to clipboard operation
maui copied to clipboard

[9.0.50 Android] Splash screen is randomly left blank

Open janne-hmp opened this issue 8 months ago • 9 comments

Description

I noticed in using Publish command on Android that splash screen files are randomly sometimes generated incorrectly, leading to a blank (normally blue in MAUI) splash screen. In particular, the file base/res/drawable/maui_splash_image.xml is then merely one line with the text layer-list. In contrast, the other splash screen file base/res/drawable/maui_splash.xml seems to be always correctly generated.

Steps to Reproduce

  1. Clone the reproduction repository at https://github.com/hyvanmielenpelit/GnollHackMAUIEasyBuild and build it according to instructions in Visual Studio 2022
  2. Choose Release configuration, and activate your Android device from the debugging device dropdown list
  3. Delete bin and obj directories if they exist
  4. Right-click on GnollHackM project and select Publish
  5. Go to step 3 or step 4 randomly until 10 archives have been created
  6. In some of these archives the file base/res/drawable/maui_splash_image.xml is correct (gnollhackicon.png is then present in various drawable folders), in some of the other ones it is not (also, no gnollhackicon.png in any folder).

Link to public reproduction project repository

https://github.com/hyvanmielenpelit/GnollHackMAUIEasyBuild

Version with bug

9.0.50 SR5

Is this a regression from previous behavior?

Yes, this used to work in Xamarin.Forms

Last version that worked well

Unknown/Other

Affected platforms

Android

Affected platform versions

Android 15

Did you find any workaround?

No.

Relevant log output


janne-hmp avatar Apr 20 '25 22:04 janne-hmp

It seems that if I delete bin and obj directories first before selecting Publish, the splash screen is more often created correctly. So perhaps a problem with using intermediate files or the like.

janne-hmp avatar Apr 21 '25 06:04 janne-hmp

Based on the reproduction steps, I am unable to reproduce the splash screen issue. The splash screen is displaying correctly. Please refer to the video below.

https://github.com/user-attachments/assets/d1b3f443-7a16-4d4e-9f4c-9d454e8c9358

Ahamed-Ali avatar Apr 21 '25 08:04 Ahamed-Ali

Can you check if that remains the case when you rebuild or build without deleting obj and bin directories? What you should notice is that the base/res/drawable/maui_splash_image.xml file becomes sometimes 18 bytes long inside the aab and all gnollhackicon.png files are missing from various drawable directories under res. This happens randomly on my side, so the occurrence may depend on the system setup or pure luck (if a threading or file access error).

janne-hmp avatar Apr 21 '25 10:04 janne-hmp

The splash screen displays properly without deleting the bin and obj folders. If you encounter the splash screen issue on any specific emulator or device, please let us know.

Ahamed-Ali avatar Apr 22 '25 09:04 Ahamed-Ali

There was certainly a (random) problem there. Let me investigate if I can found a more reliable way to replicate it. It may be due to my slow computer or something like that, so it may not necessarily appear on every development setup.

janne-hmp avatar Apr 22 '25 09:04 janne-hmp

I just had the same problem (Google Pixel 6a / Android 15). In my case it was caused by the Microsoft Launcher. The splash screen showed up again after switching to the default Google Launcher.

markusroessler avatar May 10 '25 16:05 markusroessler

This is a known issue in some launchers or running from F5. Android treats this as a special resume and thus does not load the images. This is nonsensical, but Google deemed that the best user experience.

Duplicate of https://github.com/dotnet/maui/issues/12636

Google reasoning: https://issuetracker.google.com/issues/205021357?pli=1#comment14

I think you can trigger this code path if you are resuming the app. Initial launch from the Google launcher is fine, but resumes may not load it. And I am not sure if the MS Launcher found a way, but it sometimes does trigger the icon.

mattleibow avatar May 19 '25 19:05 mattleibow

I don't think this has anything to do with the other issue. This is a problem of malformed splash screen files inside the APK that happen randomly, perhaps because something got done in the wrong order or at the same time as the files were being copied, etc. I can check that if the files are ok, then the splash screen works, if they are malformed, then the splash screen does not work. This is our standard check before publishing on Android.

janne-hmp avatar May 19 '25 21:05 janne-hmp

As a note, this random corruption of the splash screen file seems to almost never happen if I first delete bin and obj directories. So perhaps it has something to do how the build process handles existing files in those directories.

janne-hmp avatar Jun 17 '25 11:06 janne-hmp

Duplicate of #23268

PureWeen avatar Jun 26 '25 20:06 PureWeen