You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I tried using SkiaSharp in my Unity Android project, as a dependency for ScottPlot. When I test it in the Unity Editor, it's fine. But when I try to build to my android device, I run into an issue. The error is "PlatformNotSupportedException: Current platform is unknown, unable to load library 'libSkiaSharp.so'"
From what I understand, it's the PlatformConfiguration.cs that's causing this, because IsWindows/IsLinux/IsMac will all be false, leading LibraryLoader.LoadLibrary to throw the exception.
I tried modifying PlatformConfiguration.cs to check for android (can check for the environmental variable ANDROID_ROOT), but it gives another error because I think Unity doesn't place the libSkiaSharp.so where LibraryLoader expects.
In the end I compiled the SkiaSharp.dll with the USE_DELEGATES and USE_LIBRARY_LOADER flags set to false, because Unity will automatically load the .so files (if the import settings on the file are set correctly in the inspector), and I was able to get the .dll to work.
Just wondering whether this approach makes sense? Or is there a better way around this that I didn't consider?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I tried using SkiaSharp in my Unity Android project, as a dependency for ScottPlot. When I test it in the Unity Editor, it's fine. But when I try to build to my android device, I run into an issue. The error is "PlatformNotSupportedException: Current platform is unknown, unable to load library 'libSkiaSharp.so'"
From what I understand, it's the PlatformConfiguration.cs that's causing this, because IsWindows/IsLinux/IsMac will all be false, leading LibraryLoader.LoadLibrary to throw the exception.
I tried modifying PlatformConfiguration.cs to check for android (can check for the environmental variable
ANDROID_ROOT
), but it gives another error because I think Unity doesn't place the libSkiaSharp.so where LibraryLoader expects.In the end I compiled the SkiaSharp.dll with the
USE_DELEGATES
andUSE_LIBRARY_LOADER
flags set to false, because Unity will automatically load the .so files (if the import settings on the file are set correctly in the inspector), and I was able to get the .dll to work.Just wondering whether this approach makes sense? Or is there a better way around this that I didn't consider?
Beta Was this translation helpful? Give feedback.
All reactions