2shady4u / godot-sqlite

GDExtension wrapper for SQLite (Godot 4.x+)
MIT License
850 stars 76 forks source link

The app can't open android dynamic library #177

Closed papanouel closed 1 month ago

papanouel commented 1 month ago

Environment:

Issue description:

While the plugin is working perfectly fine on iOS and on my mac (running in editor), I get the following error on Android devices at launch of the app:

06-07 21:46:44.617 32767 32767 E godot : USER ERROR: Can't open dynamic library: addons/godot-sqlite/bin/libgdsqlite.android.template_debug.arm64.so. Error: dlopen failed: library "libgdsqlite.android.template_debug.arm64.so" not found. 06-07 21:46:44.617 32767 32767 E godot : at: open_dynamic_library (platform/android/os_android.cpp:200) 06-07 21:46:44.617 32767 32767 E godot : USER ERROR: GDExtension dynamic library not found: addons/godot-sqlite/bin/libgdsqlite.android.template_debug.arm64.so 06-07 21:46:44.617 32767 32767 E godot : at: open_library (core/extension/gdextension.cpp:719) 06-07 21:46:44.617 32767 32767 E godot : USER ERROR: Failed loading resource: res://addons/godot-sqlite/gdsqlite.gdextension. Make sure resources have been imported by opening the project in the editor at least once. 06-07 21:46:44.617 32767 32767 E godot : at: _load (core/io/resource_loader.cpp:275) 06-07 21:46:44.617 32767 32767 E godot : USER ERROR: Error loading extension: res://addons/godot-sqlite/gdsqlite.gdextension

Steps to reproduce:

Minimal reproduction project: It is happening at startups. The only code is below: var db= SQLite.new() db.path = "user://shots.db" var result= db.open_db()

Additional context The line referencing the library is present in gdsqlite.gdextension and in resource path android.template_release.x86_64 = "res://addons/godot-sqlite/bin/libgdsqlite.android.template_release.x86_64.so"

image
2shady4u commented 1 month ago

Hello @papanouel :)

Could you download the android binary from the latest Github Actions and see if the problem is also present there? https://github.com/2shady4u/godot-sqlite/actions/runs/9140414376

Direct link: https://github.com/2shady4u/godot-sqlite/actions/runs/9140414376/artifacts/1515868254

The binary on the Godot Asset Library might be outdated for Godot v4.2 😢

papanouel commented 1 month ago

Hello @2shady4u :) Thanks for the quick reply! I just replaced previous libraries by the new onces, but unfortunately still the same error 😕

One error log I didn't see initially appears when remote launching the app from editor to the Android device (shows up in the godot output window):

No suitable library found for GDExtension: res://addons/godot-sqlite/gdsqlite.gdextension. Possible feature flags for your platform: mobile, android, etc2, astc, arm32, arm64, template, debug, template_debug

~Also in the error log I shared with you initially it does mentioned: USER ERROR: GDExtension dynamic library not found: addons/godot-sqlite/bin/libgdsqlite.android.template_debug.arm64.so without the "res://" part of the path. Not sure it is an issue but just mentioning it just in case.~

As we never know, sharing the content of gdsqlite.gdextension, but I think everything looks fine. I'll keep checking however let me know if you have any suggestions 😊


[configuration]

entry_symbol = "sqlite_library_init" compatibility_minimum = 4.2

[libraries]

macos = "res://addons/godot-sqlite/bin/libgdsqlite.macos.template_debug.framework" macos.template_release = "res://addons/godot-sqlite/bin/libgdsqlite.macos.template_release.framework" windows.x86_64 = "res://addons/godot-sqlite/bin/libgdsqlite.windows.template_debug.x86_64.dll" windows.template_release.x86_64 = "res://addons/godot-sqlite/bin/libgdsqlite.windows.template_release.x86_64.dll" linux.x86_64 = "res://addons/godot-sqlite/bin/libgdsqlite.linux.template_debug.x86_64.so" linux.template_release.x86_64 = "res://addons/godot-sqlite/bin/libgdsqlite.linux.template_release.x86_64.so" android.arm64 = "res://addons/godot-sqlite/bin/libgdsqlite.android.template_debug.arm64.so" android.template_release.arm64 = "res://addons/godot-sqlite/bin/libgdsqlite.android.template_release.arm64.so" android.x86_64 = "res://addons/godot-sqlite/bin/libgdsqlite.android.template_debug.x86_64.so" android.template_release.x86_64 = "res://addons/godot-sqlite/bin/libgdsqlite.android.template_release.x86_64.so" ios.arm64 = "res://addons/godot-sqlite/bin/libgdsqlite.ios.template_debug.arm64.dylib" ios.template_release.arm64 = "res://addons/godot-sqlite/bin/libgdsqlite.ios.template_release.arm64.dylib" web.wasm32 = "res://addons/godot-sqlite/bin/libgdsqlite.web.template_debug.wasm32.wasm" web.template_release.wasm32 = "res://addons/godot-sqlite/bin/libgdsqlite.web.template_release.wasm32.wasm"

[dependencies]

macos = {} macos.template_release = {} windows.x86_64 = {} windows.template_release.x86_64 = {} linux.x86_64 = {} linux.template_release.x86_64 = {} android.arm64 = {} android.template_release.arm64 = {} android.x86_64 = {} android.template_release.x86_64 = {} ios.arm64 = {} ios.template_release.arm64 = {} web.wasm32 = {} web.template_release.wasm32 = {}

papanouel commented 1 month ago

FYI: I made it work by simply copy paste the libraries in the exported android build folders. So the issue is not the android libraries themselves, but the fact that during android export, Godot doesn't seem to be able to find the libraries in the addons/godot-sqlite folder 🤷 🤔 image

2shady4u commented 1 month ago

FYI: I made it work by simply copy paste the libraries in the exported android build folders. So the issue is not the android libraries themselves, but the fact that during android export, Godot doesn't seem to be able to find the libraries in the addons/godot-sqlite folder 🤷 🤔 image

That is interesting 🤔 I'll try to see if I get the same issue with my Android phone. Regardless of the results, I'll have to check if the issue is due to this repository or if there's an upstream issue in godot-cpp instead.

papanouel commented 1 month ago

Got it 👍 Thx

Quick last question and then I will leave you alone 😊 I also need arm32 version of android libraries. I saw that they were not included and thought about cloning the repository and generating the build for arch arm32 myself following the guideline you wrote. Before doing that just wanted to confirm with you if there was no specific hurdle in front of me, or eventually if you had the arm32 build already somewhere 😜

Let me know!

PS: BTW I love this plugin. Super useful!

papanouel commented 1 month ago

Nevermind. just did it, and it was super simple! Have a great weekend!!

2shady4u commented 1 month ago

I am having the same issue on my Asus ZenFone 8:

ERROR: No suitable library found for GDExtension: res://addons/godot-sqlite/gdsqlite.gdextension. Possible feature flags for your platform: mobile, android, etc2, astc, arm32, arm64, template, debug, template_debug
   at: (./editor/plugins/gdextension_export_plugin.h:129)

I assume it is an upstream issue with godot-cpp. I'll investigate a bit more...

2shady4u commented 1 month ago

@papanouel Okay, it seems that it is caused by the Android export settings :)

In the demo project I set both the armeabi-v7a and arm64-v8a architectures as being enabled:

architectures/armeabi-v7a=true
architectures/arm64-v8a=true

This results in an error because the armeabi-v7a binary is not included in the binaries of the demo project. When I disable the armeabi-v7a architecture (and thus only leave the arm64-v8a arch enabled), everything works without any issue 😄

I have pushed a fix (= disabling the armeabi-v7a architecture in the export settings) and will close this issue as a result.

shiva30122 commented 3 weeks ago

Error : No suitable library found for GDExtension: res://addons/godot-sqlite/gdsqlite.gdextension. Possible feature flags for your platform: mobile, android, etc2, astc, arm32, arm64, template, debug, template_debug, single

the res://addons/godot-sqlite/gdsqlite.gdextension dose not have compile architecture.os !. LOCATION : "res://addons/godot-sqlite/bin/"
PATH : libgdsqlite.android.template_debug.arm64.so It ONLY SUPPORTS amrabi-a8v architecture into APK , If i use "armeabi-v7a", "x86", "x86_64" then the APK CRASH even I use GRADLE into APK OR ABB

ANY SOLUTION !.................. HOW TO FIX ?....................... OR any binaries avaliabe ?...........