A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
Hi @mc ,
Thanks for reaching out.
I want to clarify that Android.Runtime.JavaProxyThrowable is not the actual root cause, it's just a wrapper exception that Android throws when a .NET exception crosses from managed code. That's why you should check the real error from the output window, scroll above JavaProxyThrowable and look for it.
Furthermore, add XamlCompileOptions.Skip will not resolve this issue because it only disables XAML compilation, and disabling Native AOT also rarely fixes this issue.
I recommend some common solutions to try:
- The most common cause of JavaProxyThrowable in MAUI 10 Android is aggressive code trimming. According to Microsoft's documentation on linking .NET MAUI Android apps, you should adjust your linker settings. Add this to your .csproj file inside a <PropertyGroup> for Android:
<PropertyGroup Condition="'$(TargetFramework)' == 'net10.0-android'">
<AndroidLinkMode>SdkOnly</AndroidLinkMode>
<TrimMode>partial</TrimMode>
</PropertyGroup>
After making these changes, close Visual Studio, delete bin and obj folders from your project, uninstall the app from your Android device/emulator, rebuild and redeploy.
- If you call API, add to
Platforms/Android/AndroidManifest.xmlthis:
<uses-permission android:name="android.permission.INTERNET" />
- If you forgot to register a service in the Dependency Injection:
builder.Services.AddSingleton<MyService>();
Android sometimes crashes differently than iOS.
Note: If you’d like me to take a closer look, please provide stack trace and error message from the output window to help me reproduce the issue.
Hope this helps! If my answer was helpful - kindly follow the instructions here so others with the same problem can benefit as well. Thanks for your time.