android: [MAUI] AndroidLinkMode None in Release mode crashes Android app during startup
Android framework version
net9.0-android
Description
If I set AndroidLinkMode to None in Release mode, the Android MAUI app is crashing during startup. It’s not possible to reproduce this in Debug mode, I think because AndroidLinkMode is ignored in debug mode.
https://github.com/user-attachments/assets/0de2ab94-c122-447e-acde-dc92b1a4085d
Steps to Reproduce
- Create new MAUI app
- Add the following code in the csproj file:
<PropertyGroup Condition=" '$(Configuration)|$(TargetFramework)|$(Platform)' == 'Release|net9.0-android|AnyCPU' ">
<AndroidLinkMode>None</AndroidLinkMode>
</PropertyGroup>
- Start the app on a emulator or physical device in release mode to an Android device
- App crashes with following exception
Assertion at /__w/1/s/src/mono/mono/mini/aot-runtime.c:3855, condition is_ok (error)' not met, function:decode_patch, module 'Microsoft.Maui.Essentials.so' is unusable (GUID of dependent assembly Xamarin.AndroidX.Core doesn't match (expected 'C042747C-8CB9-4A0C-9EF8-D0CD0D74FCE7', got '287AE6B7-3BCD-4E97-9A72-65B91A6E9135')). [monodroid] * Assertion at /__w/1/s/src/mono/mono/mini/aot-runtime.c:3855, condition is_ok (error)’ not met, function:decode_patch, module ‘Microsoft.Maui.Essentials.so’ is unusable (GUID of dependent assembly Xamarin.AndroidX.Core doesn’t match (expected ‘C042747C-8CB9-4A0C-9EF8-D0CD0D74FCE7’, got ‘287AE6B7-3BCD-4E97-9A72-65B91A6E9135’)).
Did you find any workaround?
No
Relevant log output
[ziparchive] Unable to open '/data/app/~~WVNWfZQgaofgGS7DOxd8uA==/com.companyname.mauiapp1-jscdc8vIYrhnJO-_a9OsXQ==/split_config.en.dm': No such file or directory
[ziparchive] Unable to open '/data/app/~~WVNWfZQgaofgGS7DOxd8uA==/com.companyname.mauiapp1-jscdc8vIYrhnJO-_a9OsXQ==/split_config.en.dm': No such file or directory
[nyname.mauiapp1] Entry not found
[ziparchive] Unable to open '/data/app/~~WVNWfZQgaofgGS7DOxd8uA==/com.companyname.mauiapp1-jscdc8vIYrhnJO-_a9OsXQ==/split_config.x86_64.dm': No such file or directory
[ziparchive] Unable to open '/data/app/~~WVNWfZQgaofgGS7DOxd8uA==/com.companyname.mauiapp1-jscdc8vIYrhnJO-_a9OsXQ==/split_config.x86_64.dm': No such file or directory
[nyname.mauiapp1] Entry not found
[ziparchive] Unable to open '/data/app/~~WVNWfZQgaofgGS7DOxd8uA==/com.companyname.mauiapp1-jscdc8vIYrhnJO-_a9OsXQ==/split_config.xxhdpi.dm': No such file or directory
[ziparchive] Unable to open '/data/app/~~WVNWfZQgaofgGS7DOxd8uA==/com.companyname.mauiapp1-jscdc8vIYrhnJO-_a9OsXQ==/split_config.xxhdpi.dm': No such file or directory
[nyname.mauiapp1] Entry not found
[nativeloader] Configuring classloader-namespace for other apk /data/app/~~WVNWfZQgaofgGS7DOxd8uA==/com.companyname.mauiapp1-jscdc8vIYrhnJO-_a9OsXQ==/base.apk:/data/app/~~WVNWfZQgaofgGS7DOxd8uA==/com.companyname.mauiapp1-jscdc8vIYrhnJO-_a9OsXQ==/split_config.en.apk:/data/app/~~WVNWfZQgaofgGS7DOxd8uA==/com.companyname.mauiapp1-jscdc8vIYrhnJO-_a9OsXQ==/split_config.x86_64.apk:/data/app/~~WVNWfZQgaofgGS7DOxd8uA==/com.companyname.mauiapp1-jscdc8vIYrhnJO-_a9OsXQ==/split_config.xxhdpi.apk. target_sdk_version=35, uses_libraries=, library_path=/data/app/~~WVNWfZQgaofgGS7DOxd8uA==/com.companyname.mauiapp1-jscdc8vIYrhnJO-_a9OsXQ==/lib/x86_64:/data/app/~~WVNWfZQgaofgGS7DOxd8uA==/com.companyname.mauiapp1-jscdc8vIYrhnJO-_a9OsXQ==/base.apk!/lib/x86_64:/data/app/~~WVNWfZQgaofgGS7DOxd8uA==/com.companyname.mauiapp1-jscdc8vIYrhnJO-_a9OsXQ==/split_config.en.apk!/lib/x86_64:/data/app/~~WVNWfZQgaofgGS7DOxd8uA==/com.companyname.mauiapp1-jscdc8vIYrhnJO-_a9OsXQ==/split_config.x86_64.apk!/lib/x86_64:/data/app/~~WVNWfZQgaofgGS7DOxd8uA==/com.company
[nyname.mauiapp1] JIT profile information will not be recorded: profile file does not exist.
[nyname.mauiapp1] JIT profile information will not be recorded: profile file does not exist.
[nyname.mauiapp1] JIT profile information will not be recorded: profile file does not exist.
[GraphicsEnvironment] ANGLE Developer option for 'com.companyname.mauiapp1' set to: 'default'
[GraphicsEnvironment] ANGLE GameManagerService for com.companyname.mauiapp1: false
[GraphicsEnvironment] Neither updatable production driver nor prerelease driver is supported.
[NetworkSecurityConfig] No Network Security Config specified, using platform default
[NetworkSecurityConfig] No Network Security Config specified, using platform default
[DOTNET] AndroidCryptoNative_InitLibraryOnLoad: jint AndroidCryptoNative_InitLibraryOnLoad(JavaVM *, void *) in /__w/1/s/src/native/libs/System.Security.Cryptography.Native.Android/pal_jni.c
[DOTNET] GetOptionalClassGRef: optional class com/android/org/conscrypt/OpenSSLEngineImpl was not found
[nyname.mauiapp1] * Assertion at /__w/1/s/src/mono/mono/mini/aot-runtime.c:3855, condition `is_ok (error)' not met, function:decode_patch, module 'Microsoft.Maui.Essentials.so' is unusable (GUID of dependent assembly Xamarin.AndroidX.Core doesn't match (expected '2C704347-54AE-46BB-9DE5-B233271BC9F0', got '0A9EDE43-41AB-43BC-BF50-B3008F0E94C8')).
[monodroid] * Assertion at /__w/1/s/src/mono/mono/mini/aot-runtime.c:3855, condition `is_ok (error)' not met, function:decode_patch, module 'Microsoft.Maui.Essentials.so' is unusable (GUID of dependent assembly Xamarin.AndroidX.Core doesn't match (expected '2C704347-54AE-46BB-9DE5-B233271BC9F0', got '0A9EDE43-41AB-43BC-BF50-B3008F0E94C8')).
[monodroid] Abort at mono-log-adapter.cc:46:3 ('static void xamarin::android::internal::MonodroidRuntime::mono_log_handler(const char *, const char *, const char *, mono_bool, void *)')
[libc] Fatal signal 6 (SIGABRT), code -1 (SI_QUEUE) in tid 10865 (nyname.mauiapp1), pid 10865 (nyname.mauiapp1)
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 23 (11 by maintainers)
@jonathanpeppers maybe the best option is to raise an error if this in an invalid combination?
if
AndroidLinkMode=NoneandRunAOTCompilation=truewe should error out.We have been able to fix the app crash that caused this. Was a old loading skeleton library with animations that caused the crash. This can be closed IMHO.
@grendello We have been reverting back to defaults more and more. It seems some parameter were needed in the past when it was still a Forms app. With you advices I have removed al remaining settings. Also experimental settings. Will update if this helps out at all
PublishTrimmed=falseis the same as settingAndroidLinkMode=None.Removing either of these would make the app gigantic in size. Can you go back to just using the default settings and see what the problem is there? If trimming causes an issue, file a new one for us to investigate. Thanks!
This is only the default in Debug mode, Release mode it is true.