m4gr3d / GAST

Godot Android Streaming Texture (GAST) library

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cannot get core plugin working with Godot Android build template

SanderVocke opened this issue · comments

Note: I edited this issue since the first time I submitted this, because it was ranty and not very reproducible.

I have been unable to reproduce the "edit text sample" from this project in a separate Godot project, using Godot's own Android build template as a starting point. I am probably missing some key puzzle piece here.
It would be nice to have this working and then turn it into some steps described in GAST's documentation, because I expect that most people will want to use it in this way. Using Godot's built-in build template has advantages such as:

  • starting the app from within the Godot editor and being able to adapt properties such as the app name in there
  • using remote tree view in the editor.
  • Godot lib AAR is automatically provided in the build process, no need to build it yourself.

Steps taken:

  • create an empty Godot project.
  • create an Android run configuration with custom build (installed build template from within the editor)
  • copied the Godot project contents (scenes, resources, ...) from the Edit text sample Godot project in this repo
  • copied the Kotlin activity and app files from the Edit text sample (renamed to GodotApp) and put in the src folder in the custom build
  • some tweaks to the build.gradle of the custom build folder:
    • add dependency on gast-core .aar file built from this repo
    • add JNI path to .gdns files of GAST so they can be found

By this point, it is possible to run/debug the project on an Oculus Quest 2, both from Android Studio and from the Godot editor itself. however, the GAST nodes look black instead of having the expected contents shown on them.

Further investigation yielded that the onDraw callbacks to Gast views are never called.

After a lot of trial and error, managed to find the magic that should go into the Android manifest to make this work:

<meta-data
            android:name="com.oculus.always_draw_view_root"
            android:value="true" />

(to be put under the application tag).

Apparently this tag is somehow added to the manifest during the build process of the Edit Text sample, merged from the GAST core lib. I didn't notice because I was only looking at the files in the sample folder itself - I didn't know that the final manifest is different than the initial one.

This tag can be added in the Godot-generated build template too.

I will keep the issue open, but feel free to close. The reason I think it would be good to keep this open is that it would be great to add some explanation of this to the README, or even another sample project that demonstrates "normal Godot Android usage" of the plugin, in line with the Godot instructions for Oculus Quest.

commented

I know it's been a while but I'm stuck on this. I tried adding that meta-data tag in my godot android build manifest, but on exporting that tag is removed from the file. I tried adding it when I built the android plugins in this repo but it doesn't seem to be working because the gastnode is still just black