Maui-Blazor Project Template crashes in Release Mode

Oguz Koca 1 Reputation point
2021-08-27T11:07:07.297+00:00

I'm trying to run the base maui-blazor template in Visual Studio 2022 Preview 3 in release mode. In android devices the application crashes as soon as the .net intro screen passes. (It works perfectly in debug mode). If I comment out this section in the mainpage.xaml, it works.

<b:BlazorWebView HostPage="wwwroot/index.html">
    <b:BlazorWebView.RootComponents>
        <b:RootComponent Selector="app" ComponentType="{x:Type local:Main}" />
    </b:BlazorWebView.RootComponents>
</b:BlazorWebView>

Is there any idea what can i do?

Device Log
Time Device Name Type PID Tag Message
08-25 10:01:27.911 Samsung SM-G9550 Info 3402 art Caused by: java.lang.ClassNotFoundException: Didn't find class "android.view.View$OnUnhandledKeyEventListener" on path: DexPathList[[zip file "/data/app/com.companyname.MauiApp11-1/base.apk"],nativeLibraryDirectories=[/data/app/com.companyname.MauiApp11-1/lib/x86, /data/app/com.companyname.MauiApp11-1/base.apk!/lib/x86, /system/lib, /vendor/lib]]
at java.lang.Class dalvik.system.BaseDexClassLoader.findClass(java.lang.String) (BaseDexClassLoader.java:56)
at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String, boolean) (ClassLoader.java:380)
at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String) (ClassLoader.java:312)
at void crc6488302ad6e9e4df1a.MauiAppCompatActivity.n_onCreate(android.os.Bundle) (MauiAppCompatActivity.java:-2)
at void crc6488302ad6e9e4df1a.MauiAppCompatActivity.onCreate(android.os.Bundle) (MauiAppCompatActivity.java:46)
at void android.app.Activity.performCreate(android.os.Bundle) (Activity.java:6692)
at void android.app.Instrumentation.callActivityOnCreate(android.app.Activity, android.os.Bundle) (Instrumentation.java:1118)
at android.app.Activity android.app.ActivityThread.performLaunchActivity(android.app.ActivityThread$ActivityClientRecord, android.content.Intent) (ActivityThread.java:2621)
at void android.app.ActivityThread.handleLaunchActivity(android.app.ActivityThread$ActivityClientRecord, android.content.Intent, java.lang.String) (ActivityThread.java:2729)
at void android.app.ActivityThread.-wrap12(android.app.ActivityThread, android.app.ActivityThread$ActivityClientRecord, android.content.Intent, java.lang.String) (ActivityThread.java:-1)
at void android.app.ActivityThread$H.handleMessage(android.os.Message) (ActivityThread.java:1480)
at void android.os.Handler.dispatchMessage(android.os.Message) (Handler.java:102)
at void android.os.Looper.loop() (Looper.java:154)
at void android.app.ActivityThread.main(java.lang.String[]) (ActivityThread.java:6198)
at java.lang.Object java.lang.reflect.Method.invoke!(java.lang.Object, java.lang.Object[]) (Method.java:-2)
at void com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run() (ZygoteInit.java:891)
at void com.android.internal.os.ZygoteInit.main(java.lang.String[]) (ZygoteInit.java:781)

Time Device Name Type PID Tag Message
08-25 10:01:27.911 Samsung SM-G9550 Info 3402 art Rejecting re-init on previously-failed class java.lang.Class<androidx.core.view.ViewCompat$2>: java.lang.NoClassDefFoundError: Failed resolution of: Landroid/view/View$OnUnhandledKeyEventListener;
at void crc6488302ad6e9e4df1a.MauiAppCompatActivity.n_onCreate(android.os.Bundle) (MauiAppCompatActivity.java:-2)
at void crc6488302ad6e9e4df1a.MauiAppCompatActivity.onCreate(android.os.Bundle) (MauiAppCompatActivity.java:46)
at void android.app.Activity.performCreate(android.os.Bundle) (Activity.java:6692)
at void android.app.Instrumentation.callActivityOnCreate(android.app.Activity, android.os.Bundle) (Instrumentation.java:1118)
at android.app.Activity android.app.ActivityThread.performLaunchActivity(android.app.ActivityThread$ActivityClientRecord, android.content.Intent) (ActivityThread.java:2621)
at void android.app.ActivityThread.handleLaunchActivity(android.app.ActivityThread$ActivityClientRecord, android.content.Intent, java.lang.String) (ActivityThread.java:2729)
at void android.app.ActivityThread.-wrap12(android.app.ActivityThread, android.app.ActivityThread$ActivityClientRecord, android.content.Intent, java.lang.String) (ActivityThread.java:-1)
at void android.app.ActivityThread$H.handleMessage(android.os.Message) (ActivityThread.java:1480)
at void android.os.Handler.dispatchMessage(android.os.Message) (Handler.java:102)
at void android.os.Looper.loop() (Looper.java:154)
at void android.app.ActivityThread.main(java.lang.String[]) (ActivityThread.java:6198)
at java.lang.Object java.lang.reflect.Method.invoke!(java.lang.Object, java.lang.Object[]) (Method.java:-2)
at void com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run() (ZygoteInit.java:891)
at void com.android.internal.os.ZygoteInit.main(java.lang.String[]) (ZygoteInit.java:781)

Not Monitored
Not Monitored
Tag not monitored by Microsoft.
37,133 questions
{count} votes