Matthew Pans
Matthew Pans

Reputation: 839

MAUI: The app is working fine in debug mode and craches with the APK published or in relese mode

My app is working fine in debug mode and no issues are with the UI or functionalities. But when I create the APK file, the UI color is changing and the app is breaking when tapping on a button. So I check in release mode and found the same issue.

Debug Mode Screenshot:

enter image description here

Release Mode Screenshot:

enter image description here

In release mode the app icon is also not visible on the UI. Also the launcher icon and launching screen are also breaking.

I am facing these issue after updating to .net 8 from .net 7. When the project is on .net 7 there was no such issue. Do I need to add anything else for the proper working of the app in .net 8?

VS Version: Microsoft Visual Studio Community 2022 (64-bit) - Preview Version 17.10.0 Preview 2.0

I tried the solutions on this thread and no luck.

Upvotes: 0

Views: 369

Answers (1)

Sergiu Birou
Sergiu Birou

Reputation: 58

Could be a xaml compiler optimization issue. Basically the compiler optimizes the xaml code in release mode to lower the package size or improve the overall performance of the app.

I would recommend adding

[XamlCompilation(XamlCompilationOptions.Skip)]

on the .xaml.cs files on the pages that don't render correctly and see if that makes a difference.

You can also enable the optimizations for debug mode in project properties>build so you'll see the same rendering of the page in debug mode if this is the problem.

enter image description here

Upvotes: 0

Related Questions