Monday, December 5, 2022
HomeGame Developmentandroid - Constructing SkiaSharp (Google Graphics/Drawing Library) for Unity utilization?

android – Constructing SkiaSharp (Google Graphics/Drawing Library) for Unity utilization?


I’ve put in SkiaSharp by including SkiaSharp.dll and libSkiaSharp.dll in Unity from this web page’s prepackaged zip to my Belongings/Plugin folder and the next line to csc.rsp:

-r:AssetsPluginsSkiaSharp.dll

This works in Unity Editor on Home windows. I can entry the SkiaSharp features/courses. Nevertheless, after I construct to Android and attempt to run the identical features I get:

    2022/12/04 21:01:00.790 19171 19202 Debug Unity Did not load native plugin: Unable to lookup library path for 'SkiaSharp'.
    2022/12/04 21:01:00.798 19171 19202 Error Unity DllNotFoundException: libSkiaSharp meeting:<unknown meeting> kind:<unknown kind> member:(null)
    2022/12/04 21:01:00.798 19171 19202 Error Unity   at (wrapper managed-to-native) SkiaSharp.SkiaApi.sk_memorystream_new()
    2022/12/04 21:01:00.798 19171 19202 Error Unity   at SkiaSharp.SKMemoryStream..ctor () [0x00000] in <d8a986c3a3a54171980f8dabea28fb18>:0
    2022/12/04 21:01:00.798 19171 19202 Error Unity   at SkiaSharp.SKMemoryStream..ctor (System.Byte[] information) [0x00000] in <d8a986c3a3a54171980f8dabea28fb18>:0
    2022/12/04 21:01:00.798 19171 19202 Error Unity   at SkiaSharp.SKBitmap.Decode (System.Byte[] buffer) [0x00011] in <d8a986c3a3a54171980f8dabea28fb18>:0

I feel it’s because these information are from 2017 and the Android assist was added later. Due to this fact I have to construct my very own new dll information from the SkiaSharp venture.

I attempted cloning the github https://github.com/mono/SkiaSharp.git after which proper clicking and going to properties on the SkiaSharp venture lets me set the goal construct platform to dotnet2.1 which is what I would like.

I can then proper click on the venture and construct which efficiently creates SkiaSharp.dll. Nevertheless, it does no create libSkiaSharp.dll. The one references I see on the venture to this are that it’s made if you’re concentrating on netstandard 2.0:

<ItemGroup Situation="$(TargetFramework.StartsWith('netstandard2.0'))">
    <!-- macOS -->
    <None Embrace="....outputnativeosxlibSkiaSharp*" Hyperlink="nugetruntimesosxnative%(Filename)%(Extension)" />
    <!-- Home windows -->
    <None Embrace="....outputnativewindowsx64libSkiaSharp*" Hyperlink="nugetruntimeswin-x64native%(Filename)%(Extension)" />
    <None Embrace="....outputnativewindowsx86libSkiaSharp*" Hyperlink="nugetruntimeswin-x86native%(Filename)%(Extension)" />
    <None Embrace="....outputnativewindowsarm64libSkiaSharp*" Hyperlink="nugetruntimeswin-arm64native%(Filename)%(Extension)" />
    <!-- Home windows: Nano Server -->
    <None Embrace="....outputnativenanoserverx64libSkiaSharp*" Hyperlink="nugetruntimesnanoserver-x64native%(Filename)%(Extension)" />
    <!-- Linux -->
    <None Embrace="....outputnativelinuxx64libSkiaSharp*" Hyperlink="nugetruntimeslinux-x64native%(Filename)%(Extension)" />
    <None Embrace="....outputnativelinuxx86libSkiaSharp*" Hyperlink="nugetruntimeslinux-x86native%(Filename)%(Extension)" />
    <None Embrace="....outputnativelinuxarm64libSkiaSharp*" Hyperlink="nugetruntimeslinux-arm64native%(Filename)%(Extension)" />
    <None Embrace="....outputnativelinuxarmlibSkiaSharp*" Hyperlink="nugetruntimeslinux-armnative%(Filename)%(Extension)" />
    <!-- Linux: Musl -->
    <None Embrace="....outputnativealpinex64libSkiaSharp*" Hyperlink="nugetruntimeslinux-musl-x64native%(Filename)%(Extension)" />
    <None Embrace="....outputnativealpinex86libSkiaSharp*" Hyperlink="nugetruntimeslinux-musl-x86native%(Filename)%(Extension)" />
    <None Embrace="....outputnativealpinearm64libSkiaSharp*" Hyperlink="nugetruntimeslinux-musl-arm64native%(Filename)%(Extension)" />
    <None Embrace="....outputnativealpinearmlibSkiaSharp*" Hyperlink="nugetruntimeslinux-musl-armnative%(Filename)%(Extension)" />
    <!-- Linux: No Dependencies -->
    <None Embrace="....outputnativelinuxnodepsx64libSkiaSharp*" Hyperlink="nugetruntimeslinuxnodeps-x64native%(Filename)%(Extension)" />
    <None Embrace="....outputnativelinuxnodepsx86libSkiaSharp*" Hyperlink="nugetruntimeslinuxnodeps-x86native%(Filename)%(Extension)" />
    <None Embrace="....outputnativelinuxnodepsarm64libSkiaSharp*" Hyperlink="nugetruntimeslinuxnodeps-arm64native%(Filename)%(Extension)" />
    <None Embrace="....outputnativelinuxnodepsarmlibSkiaSharp*" Hyperlink="nugetruntimeslinuxnodeps-armnative%(Filename)%(Extension)" />
    <!-- Linux: Musl, No Dependencies -->
    <None Embrace="....outputnativealpinenodepsx64libSkiaSharp*" Hyperlink="nugetruntimeslinuxnodeps-musl-x64native%(Filename)%(Extension)" />
    <None Embrace="....outputnativealpinenodepsx86libSkiaSharp*" Hyperlink="nugetruntimeslinuxnodeps-musl-x86native%(Filename)%(Extension)" />
    <None Embrace="....outputnativealpinenodepsarm64libSkiaSharp*" Hyperlink="nugetruntimeslinuxnodeps-musl-arm64native%(Filename)%(Extension)" />
    <None Embrace="....outputnativealpinenodepsarmlibSkiaSharp*" Hyperlink="nugetruntimeslinuxnodeps-musl-armnative%(Filename)%(Extension)" />
    <!-- WASM -->
    <None Embrace="....outputnativewasm**libSkiaSharp*.a" Hyperlink="nugetbuildwasm%(RecursiveDir)%(Filename)%(Extension)" />
    <None Embrace="nugetbuildwasmSkiaSharp.props" Hyperlink="nugetbuildwasmSkiaSharp.props" />
    <None Embrace="nugetbuildwasmSkiaSharp.targets" Hyperlink="nugetbuildwasmSkiaSharp.targets" />
  </ItemGroup>

Making an attempt to make use of SkiaSharp.dll with out libSkiaSharp.dll provides errors in Unity the place it says libSkiaSharp.dll cannot be discovered. As I perceive skiaSharp.dll is the C# code and libSkiaSharp.dll is the C++ code.

How do I construct the libSkiaSharp.dll file?

This website provides a find out how to construct SkiaSharp tutorial however I discover it not clear.

Thanks.

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments