Getting abort crash on all HUAWEI devices - Google Play Console

Viewed 286

I have a Xamarin.Forms application. It's quite big, containing a lot of packages, here's the list from Droid.csproj:

<ItemGroup>
    <PackageReference Include="Xamarin.Forms" Version="5.0.0.2083" />
    <PackageReference Include="Xamarin.Essentials" Version="1.6.1" />
    <PackageReference Include="Acr.UserDialogs">
      <Version>7.1.0.514</Version>
    </PackageReference>
    <PackageReference Include="SQLiteNetExtensions">
      <Version>2.1.0</Version>
    </PackageReference>
    <PackageReference Include="Xamarin.FFImageLoading.Forms">
      <Version>2.4.11.982</Version>
    </PackageReference>
    <PackageReference Include="Xamarin.Android.Support.Design">
      <Version>28.0.0.3</Version>
    </PackageReference>
    <PackageReference Include="Plugin.LocalNotification">
      <Version>5.2.0</Version>
    </PackageReference>
    <PackageReference Include="CardsView">
      <Version>2.7.0</Version>
    </PackageReference>
    <PackageReference Include="Prism.Unity.Forms">
      <Version>8.0.0.1909</Version>
    </PackageReference>
    <PackageReference Include="Xamarin.FFImageLoading.Transformations">
      <Version>2.4.11.982</Version>
    </PackageReference>
    <PackageReference Include="Xamarin.CommunityToolkit">
      <Version>1.1.0</Version>
    </PackageReference>
    <PackageReference Include="VideoLAN.LibVLC.Android">
      <Version>3.2.0</Version>
    </PackageReference>
    <PackageReference Include="SkiaSharp.Views.Forms">
      <Version>2.80.3</Version>
    </PackageReference>
    <PackageReference Include="Karamunting.Android.Wasabeef.Blurry">
      <Version>3.0.0</Version>
    </PackageReference>
    <PackageReference Include="Xamarin.Firebase.Messaging">
      <Version>60.1142.1</Version>
    </PackageReference>
    <PackageReference Include="Xamarin.Firebase.Analytics">
      <Version>60.1142.1</Version>
    </PackageReference>
    <PackageReference Include="Xamarin.GooglePlayServices.Analytics">
      <Version>60.1142.1</Version>
    </PackageReference>
    <PackageReference Include="Xamarin.GooglePlayServices.Analytics.Impl">
      <Version>60.1142.1</Version>
    </PackageReference>
    <PackageReference Include="Xamarin.Firebase.Analytics.Impl">
      <Version>60.1142.1</Version>
    </PackageReference>
    <PackageReference Include="Xamarin.Build.Download">
      <Version>0.4.11</Version>
    </PackageReference>
    <PackageReference Include="Microsoft.AppCenter">
      <Version>4.4.0</Version>
    </PackageReference>
    <PackageReference Include="Microsoft.AppCenter.Crashes">
      <Version>4.4.0</Version>
    </PackageReference>
    <PackageReference Include="Microsoft.AppCenter.Analytics">
      <Version>4.4.0</Version>
    </PackageReference>
    <PackageReference Include="Plugin.FacebookClient">
      <Version>4.0.1</Version>
    </PackageReference>
  </ItemGroup>

And in Google Play Console I can see an 'abort' crash that occurs for dozens of different HUAWEI devices (and only for HUAWEI devices) with either KIRIN or Mediatek. The stacktrace I have is pretty useless (for I tried to google anything but couldn't extract any useful info).

I myself tried to debug on Huawei Y6 2019 (one of the affected devices), looking at Device Log output, and so on... But didn't encounter an issue.

Does anybody know what causes these crashes and how can I fix them? Perhaps the problem is that Google does not support Huawei? If so, what to do in this case?

Here's a few examples of the stacktrace:

*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
pid: 0, tid: 0 >>> org.company.appname <<<

backtrace:
  #00  pc 000000000001da7e  /system/lib/libc.so (abort+58)
  #00  pc 0000000000032b3f  /system/lib/libc++.so (abort_message+86)
  #00  pc 0000000000032c27  /system/lib/libc++.so (demangling_terminate_handler()+26)
  #00  pc 000000000004197b  /system/lib/libc++.so (std::__terminate(void (*)())+2)
  #00  pc 00000000000419fd  /system/lib/libc++.so (std::terminate()+72)
  #00  pc 000000000007ecb5  /system/lib/libc++.so (std::__1::thread::~thread()+8)
  #00  pc 0000000000066f01  /system/lib/libc.so (__cxa_finalize+132)
  #00  pc 00000000000183db  /system/lib/libc.so (exit+10)
  #00  pc 000000000018ab68  /data/app/org.company.appname-rHWykFA_zFsPSZcb7hwZQQ==/split_config.armeabi_v7a.apk!lib/armeabi-v7a/libmonosgen-2.0.so (offset 0x81d000) (mono_invoke_unhandled_exception_hook+452)
*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
pid: 0, tid: 0 >>> org.company.appname <<<

backtrace:
  #00  pc 000000000006f06c  /apex/com.android.runtime/lib64/bionic/libc.so (abort+160)
  #00  pc 00000000000500fc  /system/lib64/libc++.so (abort_message+232)
  #00  pc 0000000000050218  /system/lib64/libc++.so (demangling_terminate_handler()+44)
  #00  pc 00000000000646c4  /system/lib64/libc++.so (std::__terminate(void (*)())+12)
  #00  pc 000000000006466c  /system/lib64/libc++.so (std::terminate()+52)
  #00  pc 00000000000bb150  /system/lib64/libc++.so (std::__1::thread::~thread()+20)
  #00  pc 00000000000d0f68  /apex/com.android.runtime/lib64/bionic/libc.so (__cxa_finalize+212)
  #00  pc 00000000000cc950  /apex/com.android.runtime/lib64/bionic/libc.so (exit+24)
  #00  pc 000000000015d32c  /data/app/org.company.appname-WYfJ9hsbGp5nT2Y0mO5k9w==/split_config.arm64_v8a.apk!lib/arm64-v8a/libmonosgen-2.0.so (offset 0xadd000) (mono_invoke_unhandled_exception_hook+424)
2 Answers

This is the first fix I recommend, for mysterious problems that happen only on certain devices.

If you have any LARGE bitmaps (images) in:

res/drawable/

move them to:

res/drawable-nodpi/

Certain android devices SCALE all bitmaps in /drawable/ to the current screen DPI. (A 3x DPI device might take a 512x512 image and scale it to 1536x1536). Even though that is a completely useless action to perform.

On modern phones with high DPI, if you use several of these images at once, this can consume a LOT of memory. Leading to mysterious problems.

I don't know whether this is something about how Xamarin Forms refers to bitmaps (drawables), or whether this could happen in native apps also.

We can see many GMS services are integrated in your Package List above. However, GMS-related services may not be available on Huawei devices, because it may cause abnormal crashes.

Huawei also has provided some HMS Core kit plugins for Xamarin :

Reference documents

Xamarin Plug-ins

Related