godotengine / godotengine/godot

Android build of C# project doesn’t include native libraries from NuGet packages (probably iOS also?)

Open
#97,859 15 comments 8 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug platform:android topic:dotnet
Dominant language
C++
Stars
117k
Forks
26.8k
PR merge metrics
PR metrics pending

Description

Tested versions

Godot 4.3 (but probably in all 4.x)

System information

Android

Issue description

It appears that the Android (and iOS?) build of my C# project does not include some native libraries from NuGet packages. Specifically, the SQLite.NET package, which includes native Android *.so libraries, is not being included in the build. According to the official .NET documentation, these libraries should be included (SQLite.NET Documentation).

E 0:00:01:0671 :0 @ (): System.TypeInitializationException: The type initializer for 'SQLite.SQLiteConnection' threw an exception. ---> System.DllNotFoundException: e_sqlite3 <C++ Error> System.TypeInitializationException <C++ Source> :0 <Stack Trace> :0 @ () :0 @ () :0 @ int SQLitePCL.SQLite3Provider_e_sqlite3.SQLitePCL.ISQLite3Provider.sqlite3_libversion_number() :0 @ void SQLitePCL.raw.SetProvider(SQLitePCL.ISQLite3Provider) :0 @ void SQLitePCL.Batteries_V2.Init() :0 @ SQLite.SQLiteConnection..cctor() :0 @ --- End of inner exception stack trace ---() :0 @ () :0 @ void SqLite._Ready() :0 @ bool Godot.Node.InvokeGodotClassMethod(Godot.NativeInterop.godot_string_name&, Godot.NativeInterop.NativeVariantPtrArgs, Godot.NativeInterop.godot_variant&) :0 @ bool SqLite.InvokeGodotClassMethod(Godot.NativeInterop.godot_string_name&, Godot.NativeInterop.NativeVariantPtrArgs, Godot.NativeInterop.godot_variant&) :0 @ Godot.NativeInterop.godot_bool Godot.Bridge.CSharpInstanceBridge.Call(nint, Godot.NativeInterop.godot_string_name*, Godot.NativeInterop.godot_variant**, int, Godot.NativeInterop.godot_variant_call_error*, Godot.NativeInterop.godot_variant*)

Steps to reproduce
  1. Create a new C# project targeting Android.
  2. Add the SQLite.NET NuGet package to the project.
  3. Write some code to use "SQLite.NET"
  4. Build the project targeting Android (or iOS) with "Deploy with Remote Debug" enabled.
Minimal reproduction project (MRP)

cs_libs.zip

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked cs_libs.zip minimal reproduction and reproduce the Android C# export with SQLite.NET and remote debugging enabled. Inspect the generated Android build to determine whether the NuGet native e_sqlite3 libraries are packaged; done means the reproduction loads SQLite.SQLiteConnection without a DllNotFoundException, with iOS behavior checked if applicable.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.