godotengine / godotengine/godot

net8.0-android failed to build, assembly not found

Open
#97,613 1 comment 0 reactions 0 assignees View on GitHub
enhancement platform:android topic:dotnet topic:export
Dominant language
C++
Stars
117k
Forks
26.8k
PR merge metrics
PR metrics pending

Description

### Tested versions

- Reproducible in: 4.3.stable.mono.official.77dcf97d8

### System information

Godot v4.3.stable.mono - Manjaro Linux #1 SMP PREEMPT_DYNAMIC Wed Aug 7 16:19:28 UTC 2024 - Wayland - GLES3 (Compatibility) - AMD Radeon Vega 3 Graphics (radeonsi, raven2, LLVM 18.1.8, DRM 3.57, 6.9.12-3-MANJARO) - AMD Ryzen 3 3250U with Radeon Graphics (4 Threads)

### Issue description

I am forced to use net8.0-android because I need to have SkiaSharp.NativeAssets.Android for APK.
When building APK, it emits this:
![Screenshot from 2024-09-29 15-29-35](https://github.com/user-attachments/assets/60cfd0e9-340c-4301-be47-b27138e98915)

Though, if I use net8.0 it will be built. But libSkiaSharp dll won't be found (during using the application) [messages from logcat]
```
09-29 13:49:30.972 9234 9354 E godot : USER ERROR: System.TypeInitializationException: The type initializer for 'SkiaSharp.SKImageInfo' threw an exception.
09-29 13:49:30.972 9234 9354 E godot : ---> System.DllNotFoundException: libSkiaSharp
09-29 13:49:30.972 9234 9354 E godot : at SkiaSharp.SKImageInfo..cctor()
09-29 13:49:30.972 9234 9354 E godot : --- End of inner exception stack trace ---
09-29 13:49:30.972 9234 9354 E godot : at SkiaSharp.Views.Godot.SKControl._Draw()
09-29 13:49:30.972 9234 9354 E godot : at Godot.CanvasItem.InvokeGodotClassMethod(godot_string_name& method, NativeVariantPtrArgs args, godot_variant& ret)
09-29 13:49:30.972 9234 9354 E godot : at Godot.Control.InvokeGodotClassMethod(godot_string_name& method, NativeVariantPtrArgs args, godot_variant& ret)
09-29 13:49:30.972 9234 9354 E godot : at SkiaSharp.Views.Godot.SKControl.InvokeGodotClassMethod(godot_string_name& method, NativeVariantPtrArgs args, godot_variant& ret)
09-29 13:49:30.972 9234 9354 E godot : at Godot.Bridge.CSharpInstanceBridge.Call(IntPtr godotObjectGCHandle, godot_string_name* method, godot_variant** args, Int32 argCount, godot_variant_call_error* refCallError, godot_variant* ret)
09-29 13:49:30.972 9234 9354 E godot : at: void Godot.NativeInterop.ExceptionUtils.LogException(System.Exception) (:0)
```

I expected from one of these, I can use SkiaSharp on Android.

### Steps to reproduce

1. Clone recursively: [GitHub](https://github.com/symful/kaolin.flow-godot-skiasharp)
2. Open the Godot project in the `scene/` folder
3. Export Android

You may change the `TargetFramework` in the folder to `net8.0`, compile it, then run in your phone to test it out for the second case I mentioned above.

### Minimal reproduction project (MRP)

https://github.com/symful/kaolin.flow-godot-skiasharp (not so minimal, but I don't have time to make one)

Contributor guide

Open the contributing guide

Research direction

Start with the linked kaolin.flow-godot-skiasharp project, open the Godot project in the scene/ folder, and reproduce the Android export with TargetFramework set to net8.0-android. Compare it with the net8.0 build and its logcat output; done means the Android export succeeds and the application can load libSkiaSharp.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, csharp
Domain
build-system, mobile-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.