App deployed as system (in /system/app or /product/app) crashes on launch (dlopen failed: library "libmonosgen-2.0.so" not found)
- Dominant language
- C#
- Stars
- 2.1k
- Forks
- 579
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 252
Description
### Android framework version
net9.0-android
### Affected platform version
VS 2022 17.14.8
### Description
When deploying an APK to the system or product partition (via adb push) in one of the following paths:
- /system/app
- /system/priv-app
- /product/app
- /product/priv-app
restarting the device and attempting to launch, the app immediately crashes due to "not found" mono/.NET libraries.
### Steps to Reproduce
Perform steps listed in repro here: https://github.com/dotnet/android/issues/10356 (it should sign correctly, don't mind the comments there)
### Did you find any workaround?
Deploying the app again, but in the regular path (/data/app), via Visual Studio, Android now detects that the app exists there and successfully loads the needed libraries during startup.
### Relevant log output
```shell
2025-07-30 23:42:35.374 3491-3491 android.testapp com.mgpstudio.team.android.testapp I Using CollectorTypeCMC GC.
2025-07-30 23:42:35.375 3491-3491 android.testapp com.mgpstudio.team.android.testapp W Unexpected CPU variant for x86: x86_64.
Known variants: atom, sandybridge, silvermont, goldmont, goldmont-plus, goldmont-without-sha-xsaves, tremont, kabylake, alderlake, default
2025-07-30 23:42:35.388 3491-3491 nativeloader com.mgpstudio.team.android.testapp D Load libframework-connectivity-tiramisu-jni.so using APEX ns com_android_tethering for caller /apex/com.android.tethering/javalib/framework-connectivity-t.jar: ok
2025-07-30 23:42:35.433 3491-3491 ziparchive com.mgpstudio.team.android.testapp W Unable to open '/product/priv-app/MGPAndroidTestApp/MGPAndroidTestApp.dm': No such file or directory
2025-07-30 23:42:35.434 3491-3491 ziparchive com.mgpstudio.team.android.testapp W Unable to open '/product/priv-app/MGPAndroidTestApp/MGPAndroidTestApp.dm': No such file or directory
2025-07-30 23:42:35.441 3491-3491 nativeloader com.mgpstudio.team.android.testapp D InitLlndkLibrariesProduct: libEGL.so:libGLESv1_CM.so:libGLESv2.so:libGLESv3.so:libRS.so:libandroid_net.so:libapexsupport.so:libavf.so:libbinder_ndk.so:libc.so:libcgrouprc.so:libclang_rt.asan-x86_64-android.so:libcom.android.tethering.connectivity_native.so:libdl.so:libft2.so:liblog.so:libm.so:libmediandk.so:libnativewindow.so:libneuralnetworks.so:libselinux.so:libsync.so:libvendorsupport.so:libvndksupport.so:libvulkan.so
2025-07-30 23:42:35.442 3491-3491 nativeloader com.mgpstudio.team.android.testapp D Configuring product-clns-7 for unbundled product apk /product/priv-app/MGPAndroidTestApp/MGPAndroidTestApp.apk. target_sdk_version=35, uses_libraries=, library_path=/product/priv-app/MGPAndroidTestApp/lib/x86_64:/product/priv-app/MGPAndroidTestApp/MGPAndroidTestApp.apk!/lib/x86_64:/product/lib64:/system/product/lib64, permitted_path=/data:/mnt/expand:/data/user/0/com.mgpstudio.team.android.testapp:/product/lib64:/system/product/lib64
2025-07-30 23:42:35.445 3491-3491 nativeloader com.mgpstudio.team.android.testapp D InitVndkspLibrariesProduct: VNDK is deprecated with product
2025-07-30 23:42:35.450 3491-3491 CompatChangeReporter com.mgpstudio.team.android.testapp D Compat change id reported: 202956589; UID 1000; state: ENABLED
2025-07-30 23:42:35.454 3491-3491 android.testapp com.mgpstudio.team.android.testapp I AssetManager2(0x7f86b6c18e58) locale list changing from [] to [en-US]
2025-07-30 23:42:35.461 3491-3491 GraphicsEnvironment com.mgpstudio.team.android.testapp V Currently set values for:
2025-07-30 23:42:35.462 3491-3491 GraphicsEnvironment com.mgpstudio.team.android.testapp V angle_gl_driver_selection_pkgs=[]
2025-07-30 23:42:35.462 3491-3491 GraphicsEnvironment com.mgpstudio.team.android.testapp V angle_gl_driver_selection_values=[]
2025-07-30 23:42:35.463 3491-3491 GraphicsEnvironment com.mgpstudio.team.android.testapp V com.mgpstudio.team.android.testapp is not listed in per-application setting
2025-07-30 23:42:35.463 3491-3491 GraphicsEnvironment com.mgpstudio.team.android.testapp V Neither updatable production driver nor prerelease driver is supported.
2025-07-30 23:42:35.472 3491-3491 MultiDex com.mgpstudio.team.android.testapp I VM with version 2.1.0 has multidex support
2025-07-30 23:42:35.472 3491-3491 MultiDex com.mgpstudio.team.android.testapp I install
2025-07-30 23:42:35.473 3491-3491 MultiDex com.mgpstudio.team.android.testapp I VM has multidex support, MultiDex support library is disabled.
2025-07-30 23:42:35.489 3491-3491 nativeloader com.mgpstudio.team.android.testapp D Load libmonosgen-2.0.so using class loader ns product-clns-7 (caller=/product/priv-app/MGPAndroidTestApp/MGPAndroidTestApp.apk): dlopen failed: library "libmonosgen-2.0.so" not found
2025-07-30 23:42:35.489 3491-3491 AndroidRuntime com.mgpstudio.team.android.testapp D Shutting down VM
2025-07-30 23:42:35.491 3491-3491 AndroidRuntime com.mgpstudio.team.android.testapp E FATAL EXCEPTION: main
Process: com.mgpstudio.team.android.testapp, PID: 3491
java.lang.UnsatisfiedLinkError: dlopen failed: library "libmonosgen-2.0.so" not found
at java.lang.Runtime.loadLibrary0(Runtime.java:1113)
at java.lang.Runtime.loadLibrary0(Runtime.java:1035)
at java.lang.System.loadLibrary(System.java:1765)
at mono.MonoPackageManager.LoadApplication(MonoPackageManager.java:100)
at mono.MonoRuntimeProvider.attachInfo(MonoRuntimeProvider.java:35)
at android.app.ActivityThread.installProvider(ActivityThread.java:8509)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:8024)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:7682)
at android.app.ActivityThread.-$$Nest$mhandleBindApplication(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2500)
at android.os.Handler.dispatchMessage(Handler.java:109)
at android.os.Looper.loopOnce(Looper.java:232)
at android.os.Looper.loop(Looper.java:317)
at android.app.ActivityThread.main(ActivityThread.java:8934)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:591)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:911)
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.