Repository navigation
Closed as not planned
Closed as not planned
Copy link
Labels
Area: App RuntimeIssues in `libmonodroid.so`.
Milestone
Description
Steps to Reproduce
Unfortunately I not have know the steps to reproduce the problem, it happens in some devices (near 10% of device users) and are reported only in the Google Play Console, neither in appcenter are showed.
Expected Behavior
All must works fine, the service should run without crashes.
Actual Behavior
I have had many crashes reported only in the Google Play Console, neither in appcenter are showed. The issue happens in Android 7.1, 8, 8.1 and 9.
Version Information
Microsoft Visual Studio Enterprise 2019
Version 16.5.2
VisualStudio.16.Release/16.5.2+29926.136
Microsoft .NET Framework
Version 4.8.03752
Installed Version: Enterprise
Microsoft JVM Debugger 1.0
Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines
Mono Debugging for Visual Studio 16.5.514 (c4f36a9)
Support for debugging Mono processes with Visual Studio.
Xamarin 16.5.000.528 (d16-5@2b54082)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.
Xamarin Designer 16.5.0.470 (remotes/origin/d16-5@681de3fd6)
Visual Studio extension to enable Xamarin Designer tools in Visual Studio.
Xamarin Templates 16.5.49 (0904f41)
Templates for building iOS, Android, and Windows apps with Xamarin and Xamarin.Forms.
Xamarin.Android SDK 10.2.0.100 (d16-5/988c811)
Xamarin.Android Reference Assemblies and MSBuild support.
Mono: c0c5c78
Java.Interop: xamarin/java.interop/d16-5@fc18c54
ProGuard: xamarin/proguard/master@905836d
SQLite: xamarin/sqlite/3.28.0@46204c4
Xamarin.Android Tools: xamarin/xamarin-android-tools/d16-5@9f4ed4b
Xamarin.iOS and Xamarin.Mac SDK 13.16.0.11 (aa73e41)
Xamarin.iOS and Xamarin.Mac Reference Assemblies and MSBuild support.
Crash stack trace (Google Play Console)
java.lang.UnsatisfiedLinkError:
at mono.android.Runtime.register (Native Method)
at studying.mainService.<clinit>
at java.lang.Class.newInstance (Native Method)
at android.app.ActivityThread.handleCreateService (ActivityThread.java:3302)
at android.app.ActivityThread.-wrap5 (ActivityThread.java)
at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1636)
at android.os.Handler.dispatchMessage (Handler.java:102)
at android.os.Looper.loop (Looper.java:154)
at android.app.ActivityThread.main (ActivityThread.java:6351)
at java.lang.reflect.Method.invoke (Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:896)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:786)
Appstore build properties
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'AppStore|AnyCPU'">
<DefineConstants>TRACE;;MODE_APPSTORE;MODE_RELEASE;MODE_ONLINE</DefineConstants>
<Optimize>true</Optimize>
<AndroidUseSharedRuntime>False</AndroidUseSharedRuntime>
<AndroidLinkMode>SdkOnly</AndroidLinkMode>
<EmbedAssembliesIntoApk>True</EmbedAssembliesIntoApk>
<BundleAssemblies>True</BundleAssemblies>
<AndroidCreatePackagePerAbi>True</AndroidCreatePackagePerAbi>
<Debugger>Xamarin</Debugger>
<AotAssemblies>true</AotAssemblies>
<EnableLLVM>true</EnableLLVM>
<AndroidEnableMultiDex>false</AndroidEnableMultiDex>
<DebugSymbols>False</DebugSymbols>
<JavaMaximumHeapSize>1G</JavaMaximumHeapSize>
<OutputPath>bin\AppStore\</OutputPath>
<AndroidSupportedAbis>
</AndroidSupportedAbis>
<AndroidDexTool>d8</AndroidDexTool>
<AndroidLinkTool>r8</AndroidLinkTool>
<AndroidEnableProfiledAot>false</AndroidEnableProfiledAot>
<AndroidEnableSGenConcurrent>true</AndroidEnableSGenConcurrent>
<AndroidPackageFormat>apk</AndroidPackageFormat>
<MandroidI18n />
</PropertyGroup>
Print screen of main related devices
Please, can anyone help me?
Reacted by David Márquez Fàbrega
Metadata
Metadata
Assignees
Labels
Area: App RuntimeIssues in `libmonodroid.so`.



Activity
jonpryor commentedon Apr 15, 2020
Unfortunately, I know what this error means but not why it occurs, much less how to reliably fix it.
What the
java.lang.UnsatisfiedLinkErrormeans is thatlibmonodroid.sohasn't been loaded, e.g. a "should have previously executed"System.loadLibrary("monodroid")was not, in fact, executed. Or it was executed, and it didn't fail, but it didn't work right. Or it failed, but it didn't prevent the process from starting. Or…?The why is where things get less explainable: why didn't
libmonodroid.soget loaded? (See above questions, none of which are answerable with what the Google Play Console provided you.)We have also seen instances in which Android doesn't properly handle
.apkupgrades when the.apkcontains native libraries, e.g. some of the native libraries weren't upgraded.You may consider trying setting the
@android:extractNativeLibsattribute within the<application/>element tofalse: https://github.com/xamarin/xamarin-android/blob/f4fc2552299a3174a14dfeb314a2d3867218037d/Documentation/guides/extract-native-libraries.mdfernandovm commentedon Apr 16, 2020
Hi @jonpryor, thank you for attention.
I understand, I would like to help to investigate the issue, but it is a bit obscure and never has happens in my development devices. The fact that crash is not reported by appcenter not helps, if it was tracked I would has more informations about the issue.
I will consider the tip of use the @android:extractNativeLibs attribute but, additionaly, hoping to maybe help, som facts about the issue:
Near 95% of affected are LG (K30, K9 and Q6) or Zenfone (3, 4 and 5) devices.
Near 98% of the incidence of this issue happens after I migrate for Xamarin Forms 4, enabled the options AOT Compilation / Use LLVM and migration for dx/r8.
moljac commentedon May 18, 2020
@fernandovm
Please provide some feedback for further investigation. Otherwise we will be forced to close the issue.
Thanks
fernandovm commentedon May 18, 2020
@moljac, the issue continue, mainly with the same cited devices, but I not have new technical details to add. It never has happens in my development devices, neither in appcenter it are showed. See, in the last 7 days:
fernandovm commentedon May 19, 2020
@moljac, if there is any other tests that I can do to help identify the issue, I will do it, but until now I couldn't think new ideas. :((
MarvinFrankenfeld commentedon Jun 5, 2020
@jonpryor , android:extractNativeLibs is only relevant when using apk and not aab, right?
fernandovm commentedon Jun 12, 2020
Guys, in the last night I made some tests alternating the android options
AOT CompilationandUse LLVMand I have noted that several times afeter an app update alternating this options (from/to, on->off, off->on) I get "abnormally" erros, such as:06-10 15:10:34.028 23157 23157 I art : Caused by: java.lang.ClassNotFoundException: Didn't find class "android.view.View$OnUnhandledKeyEventListener" on path: DexPathList .....Could this be related with this issue also?
moljac commentedon Jun 13, 2020
@fernandovm
Could you try R8 (proguard) rules to
keepthose classes, please?R8 is aggressive and some classes might be removed before AOT.
I would try:
Search GPS-FB for some samples
See:
https://github.com/xamarin/GooglePlayServicesComponents/blob/eb83fc7758467efffd568157e5855aa63c7018d5/samples/all/FbAll/proguard.cfg
https://github.com/xamarin/GooglePlayServicesComponents/blob/eb83fc7758467efffd568157e5855aa63c7018d5/samples/all/GpsBuildAll/proguard.cfg
fernandovm commentedon Jun 14, 2020
Ok, thanks, I will try.
radekdoulik commentedon Jul 15, 2020
Did @moljac suggestion work?
fernandovm commentedon Jul 15, 2020
Yes, it works, but it is about OnUnhandledKeyEventListener, not about the main issue, this continue generating bad indicators in Google Play Console.
holecekp commentedon Sep 24, 2020
Any update? I have similar crash reports in Google Play - the error is UnsatisfiedLinkError but the stack trace is different. I have thought that it is a Xamarin.Forms problem so I posted the issue details there: xamarin/Xamarin.Forms#12218
alexcohn commentedon May 6, 2021
Quite contrary. The trouble with LG is that they don't correctly handle the
@android:extractNativeLibs="false"attribute within the when the app is installed on the sd-card. Some Xiaomi (and other) devices fail withextractNativeLibs="false"even if the app is installed in the primary storage.This is especially relevant for aab because there
extractNativeLibs="false"has always been the default, so you must explicitly set@android:extractNativeLibs="true"to make sure your app works smoothly on all devices . Note that the default for apk has silently changed (it's same as aab now) with introduction of Android Gradle plugin 3.6.0 in February 2020.It's very unfortunate that this still haunts us 5 years after the optimization was introduced for Android 6. IMHO, part of the problem is an unintuitive choice of the attribute name.
grendello commentedon Aug 2, 2021
@alexcohn The issue of
@android:extractNativeLibs="false"being unreliable has been addressed in bf657e8 (it wasn't just LG devices). We no longer trust it in any shape or form.holecekp commentedon May 12, 2022
Occasional UnsatisfiedLinkError crashes are still reported by Google Play Console. I am using Xamarin.Forms version 5.0.0.2337.
DiebBlue commentedon Jul 18, 2022
I had nearly the same crash report on the google play console as @holecekp. I also use Xamarin Forms 5.0.0.2337. This error occurred in a peak only on 07/15/2022 on Samsung Galaxy J6, Samsung Galaxy M20 and Huawai Mate 20 lite devices, not otherwise. Neither before nor after. Could maintenance work at Google be behind this?
java.lang.UnsatisfiedLinkError: at java.lang.Runtime.loadLibrary0 (Runtime.java:1067) at java.lang.Runtime.loadLibrary0 (Runtime.java:1007) at java.lang.System.loadLibrary (System.java:1667) at mono.MonoPackageManager.LoadApplication (MonoPackageManager.java:78) at mono.MonoRuntimeProvider.attachInfo (MonoRuntimeProvider.java:35) at android.app.ActivityThread.installProvider (ActivityThread.java:7545) at android.app.ActivityThread.installContentProviders (ActivityThread.java:7090) at android.app.ActivityThread.handleBindApplication (ActivityThread.java:6978) at android.app.ActivityThread.access$1300 (ActivityThread.java:270) at android.app.ActivityThread$H.handleMessage (ActivityThread.java:2051) at android.os.Handler.dispatchMessage (Handler.java:107) at android.os.Looper.loop (Looper.java:237) at android.app.ActivityThread.main (ActivityThread.java:7948) at java.lang.reflect.Method.invoke (Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:493) at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1075)holecekp commentedon Aug 10, 2022
Is there any progress? I am getting occasionally crash reports also for my app installed directly from Google Play:
jpobst commentedon May 13, 2024
With support for Classic Xamarin.Android ended May 1st, 2024, this issue is likely no longer relevant.
If this still persists in .NET 8+, please open a new issue with updated information based on
net8.0-androidor greater. Please include a link to this issue for context.