SkiaSharp: SkiaSharp.Views.Forms crashes on Android x86 on startup

Hello. An app with SkiaSharp.Views.Forms crashes on Android x86 on startup with the following messages:

Time	Device Name	Type	PID	Tag	Message
08-02 11:46:07.558	Asus _T00I	Info	574	ActivityManager	Process com.companyname.Mobile (pid 19455) has died.
08-02 11:46:07.548	Asus _T00I	Error	19455	monodroid	shared runtime initialization error: Cannot load library: 
08-02 11:46:07.548	Asus _T00I	Warning	19455	monodroid	Trying to load sgen from: /data/data/com.companyname.Mobile/files/.__override__/libmonosgen-2.0.so
08-02 11:46:07.548	Asus _T00I	Warning	19455	monodroid	Trying to load sgen from: /data/data/com.companyname.Mobile/files/.__override__/links/libmonosgen-2.0.so
08-02 11:46:07.548	Asus _T00I	Warning	19455	monodroid	Trying to load sgen from: /storage/emulated/0/Android/data/com.companyname.Mobile/files/.__override__/libmonosgen-2.0.so
08-02 11:46:07.548	Asus _T00I	Warning	19455	monodroid	Using override path: /storage/emulated/0/Android/data/com.companyname.Mobile/files/.__override__
08-02 11:46:07.548	Asus _T00I	Warning	19455	monodroid	Trying to load sgen from: /data/app-lib/com.companyname.Mobile-1/libmonosgen-2.0.so
08-02 11:46:07.548	Asus _T00I	Warning	19455	monodroid	Using override path: /data/data/com.companyname.Mobile/files/.__override__
08-02 11:46:07.538	Asus _T00I	Warning	19455	monodroid	Creating public update directory: `/data/data/com.companyname.Mobile/files/.__override__`
08-02 11:46:07.348	Asus _T00I	Debug	19455	dalvikvm	Added shared lib /data/app-lib/com.companyname.Mobile-1/libmonodroid.so 0x438f7b10
08-02 11:46:07.338	Asus _T00I	Debug	19455	dalvikvm	Trying to load lib /data/app-lib/com.companyname.Mobile-1/libmonodroid.so 0x438f7b10

When SkiaSharp.Views.Forms is unloaded then it loads the app fine.

I’ve tried it with both shared (SkiaSharp.Views.Forms is added to Android project) and PCL (SkiaSharp.Views.Forms is added to PCL project only) projects.

Model: ASUS Zenfone 4 Version: Android 4.4.2 CPU: Intel Atom x86

Maybe it’s related to Android version but I think the reason is the ABI x86.

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 20 (2 by maintainers)

Most upvoted comments

Alright, this is so weird. I kind of found the root of the problem.

I tried to manually copy libSkiaSharp.so into [bundle]/lib/ from the apk from /lib/x86/ since I have an x86 CPU. It failed to load it again.

Then I decided to try an alternative ABI but before that I decided to just display my main and alt ABIs by using Android.OS.Build.CpuAbi + ", " + Android.OS.Build.CpuAbi2. And I got the following displayed: armeabi-v7a, armeabi What? No x86 at all?

Then I decided to copy libSkiaSharp.so again but from the apk from /lib/armeabi-v7a/ this time. And it started finally working.

The solution for personal use is ofc fine but I need one for public distribution.

Now I think during installation it tries to copy an x86 lib since the CPU is x86 then it fails some internal check for Android.OS.Build ABI because it’s either armeabi-v7a or armeabi so it doesn’t copy anything at all. By the way, libSkiaSharp.so is also missing in the apk in /lib/armeabi/.

Any thought on how to handle that?

P.S.: sorry for the wall of replies on this issue. P.S.S.: on the emulator it displays x86, and it works fine.