Typical cause: missing android:exported
attribute in the main activity after targetting Android 12+. Add the attribute to your MainActivity.cs
or manifest.
<activity android:name=".MainActivity"
android:exported="true"
android:label="@string/app_name">
</activity>
Rebuild and redeploy the app.
Ensure Info.plist
has the correct UIRequiresFullScreen
key set to true
if using splash screen or custom renderers.
<key>UIRequiresFullScreen</key>
<true/>
Also verify the launch storyboard is correctly referenced.
Cause: Event handlers not unsubscribed. Use WeakReference
or dispose pattern.
public class MyPage : ContentPage
{
private readonly Button _button;
public MyPage()
{
_button = new Button();
_button.Clicked += OnClicked;
}
protected override void OnDisappearing()
{
base.OnDisappearing();
_button.Clicked -= OnClicked; // Unsubscribe
}
private void OnClicked(object sender, EventArgs e) { … }
}
Ensure x:Class
matches the code-behind namespace and class name. Clean and rebuild the solution.
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="MyApp.Views.MainPage">
…
</ContentPage>