0 votes

(Note: edited to have a minimal example)

Hi everyone!

It seems that the Android "Use custom build" template is not compatible with including .so libraries - or at least not with those included in the "godot_ovrmobile" addon for Oculus Quest 2.

Minimal example: I started an empty project and following the steps from https://docs.godotengine.org/en/stable/tutorials/vr/developing_for_oculus_quest.html. After those steps, doing a remote run on the Quest works fine.

Then, in export settings, I checked "Use Custom Build" and installed the build template. Doing a remote run again, everything seems to build fine and I can deploy on the Quest. However, the app doesn't start. When remote debug is enabled, the following errors appear to be happening at run-time:

E 0:00:00.221   open_dynamic_library: Can't open dynamic library: libgodot_ovrmobile.so, error: dlopen failed: library "libgodot_ovrmobile.so" not found.
C++ Error   Condition "!p_library_handle" is true. Returned: ERR_CANT_OPEN
C++ Source  platform/android/os_android.cpp:228 @ open_dynamic_library()

E 0:00:00.305   open_dynamic_library: Can't open dynamic library: libgodot_ovrmobile.so, error: dlopen failed: library "libgodot_ovrmobile.so" not found.
C++ Error   Condition "!p_library_handle" is true. Returned: ERR_CANT_OPEN
C++ Source  platform/android/os_android.cpp:228 @ open_dynamic_library()

E 0:00:00.305   get_symbol: No valid library handle, can't get symbol from GDNative object
C++ Source  modules/gdnative/gdnative.cpp:502 @ get_symbol()

E 0:00:00.305   init_library: No nativescript_init in "res://addons/godot_ovrmobile/libs/arm64-v8a/libgodot_ovrmobile.so" found
C++ Source  modules/gdnative/nativescript/nativescript.cpp:1479 @ init_library()

upon inspecting the generated .apk, I can see that the .so has been bundled in /assets/addons/godot_ovrmobile/libs/arm64-v8a/. However, with the default export, it is located in the /libs folder in the APK, which I guess is where it should be.

I don't know whether this is a bug or not, but either way I also don't know how to fix the build template to include the .so in the proper place. Can anyone help me out with this?

Cheers!

Godot version 3.3
in Engine by (16 points)
edited by

1 Answer

0 votes

OK, so I have found a solution to this, although I am still not sure whether this is supposed to require manual edits to the build template:

in the generated build template's "build.gradle" file, found the entries for "jniLibs" and added the paths to the godot_ovrmobile libs folder there. The packager then grabs the libraries within and puts them under "lib" in the APK, making them loadable.

The following shows where to add it (omitted a lot of other keys in there):

android {
  sourceSets {
    debug.jniLibs.srcDirs = [
        'libs/debug',
        '../../addons/godot_ovrmobile/libs'
    ]
    release.jniLibs.srcDirs = [
        'libs/release',
        '../../addons/godot_ovrmobile/libs'
    ]

My question still remains whether this is supposed to be such a manual process.

by (16 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.