Skip to content
This repository has been archived by the owner on Feb 1, 2024. It is now read-only.

Refactor the project in accordance with the new Godot Android plugin v1 architecture #94

Merged
merged 1 commit into from
Apr 1, 2020

Conversation

m4gr3d
Copy link
Collaborator

@m4gr3d m4gr3d commented Mar 18, 2020

This transforms the original project into an Android library project, which has the nice side effect of simplifying integration with Android Studio and gradle.

Resolves #93

@m4gr3d m4gr3d added the enhancement New feature or request label Mar 18, 2020
@m4gr3d m4gr3d added this to the 2.0.0 milestone Mar 18, 2020
@m4gr3d m4gr3d force-pushed the 2.0 branch 3 times, most recently from 1e2e8a5 to 11ab5fa Compare March 23, 2020 21:18
@m4gr3d
Copy link
Collaborator Author

m4gr3d commented Mar 27, 2020

@NeoSpark314 @BastiaanOlij ping!

@NeoSpark314
Copy link
Collaborator

I get the following error when trying to deploy the demo project (after I added the empty settings.gradle file):

image

do you have an idea what could cause this?

- Select `Required` if your app only uses hand tracking.
- `Custom Template`
- `Use Custom Build` must be enabled.
- `Plugins` list must contain `OVRMobile`. This enables the `OVRMobile` plugin for the project.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this Plugins list? I can't find it in the export settings.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@NeoSpark314 To test this change, you must build the latest version of the Godot 3.2 branch and use that.

@m4gr3d
Copy link
Collaborator Author

m4gr3d commented Mar 29, 2020

I get the following error when trying to deploy the demo project (after I added the empty settings.gradle file):

image

do you have an idea what could cause this?

Make sure you build both the release and release_debug Godot shared libraries via scons prior to building the Godot Android templates.
Once that's done, reinstall the Android custom build templates using the newly built templates.
The error you're seeing occurs when one of the target (release in this case) is missing from the generated Godot templates.

@NeoSpark314
Copy link
Collaborator

Thank you @m4gr3d; now I can export/deploy an .apk; I also updated to the recent 3.2 branch and now have the plugins setting in the export but I think I'm still missing something as the plugin is still not added to the generated .apk file it seems:

I have in demo/android/plugins/ the .aar files generated from the build (is there a difference between OVRMobile-debug/release.aar and plugin-debug/release.aar?)

And I have added OVRMobile to the Plugins parameter in the Custom Template export options.

But the resulting .apk does not include the scripts and binaries from the OVRMobile plugin.

Also is it correct that with new system you will not be able anymore to read the OvrVrApiTypes.gd script files form the ovrmobile plugin in the game project anymore?

@m4gr3d
Copy link
Collaborator Author

m4gr3d commented Mar 29, 2020

@NeoSpark314 Only one of the OVRMobile*.aar file should be added to the demo/android/plugins directory otherwise they'll collide with each other.

How do you check the resulting apk? A aar file is merged into the final apk so you won't see it as a standalone file if you look into the apk, although you can see its component if you look at the classes directory or assets directory.

All the existing functionality is conserved with the new system, nothing is lost :)

@NeoSpark314
Copy link
Collaborator

I removed all other .aar files now and have only the OVRMobile-Debug.aar in the plugins folder;
I am checking in the exported .apk for the plugin .gd files and also if the libvrapi.so and libgodot_ovrmobile.so file are in there. (When I start on the quest I get the error that the .gd script files are not found).

To me it looks like the .aar file is not merged at all (I'm probably still missing some setting or parameter somehwere):

This is the content of the lib folder in my exported .apk
image

This is the content of the OVRMobile-debug.aar file I have in the plugins folder (here the libraries are in a jni subfolder):
image

And these are my export settings (I export debug):
image

@m4gr3d
Copy link
Collaborator Author

m4gr3d commented Mar 29, 2020

@NeoSpark314 can you also provide a screenshot for the directory containing the AAR file, as well as a screenshot of the build.gradle file.

@NeoSpark314
Copy link
Collaborator

Here is my android/plugins folder:
image

and this is the build folder created by godot:
image

Here are also the .aar file and the generated build.gradle if this contains useful information.

build.gradle.zip
OVRMobile-debug.aar.zip

@m4gr3d
Copy link
Collaborator Author

m4gr3d commented Mar 30, 2020

@NeoSpark314 either your 3.2 branch is not up-to-date, or the Godot templates file were not regenerated after updating it.
The build.gradle file you attached is the older version and doesn't match the latest from the 3.2 branch.

Once you regenerate the Godot templates, make sure to update your build of Godot with the new files (location typically varies based on the OS), nuke your current android directory, and reinstall it from the Godot menu interface.

@NeoSpark314
Copy link
Collaborator

Ok; I cleaned and rebuild everything with the current 3.2 master; now I get the following error:
image
Do I need to downgrade my NDK or is this only a configuration issue?

@m4gr3d
Copy link
Collaborator Author

m4gr3d commented Mar 31, 2020

Ok; I cleaned and rebuild everything with the current 3.2 master; now I get the following error:
image
Do I need to downgrade my NDK or is this only a configuration issue?

Someone on IRC was having the same issue and it was caused by environment variables; i.e: Android Studio and the shell used by Godot see two different things.
You should be able to solve the issue via this stack overflow post.

@NeoSpark314
Copy link
Collaborator

@m4gr3d now it works; thanks for your help, patience and great work on restructuring the whole android build system! Now I think I have seen enough of the new system to potentially help others too when they run into problems :-)

For now I solved the NDK verison system by adding the specific version to the android section in the build.gradle. Not sure where it picks up the older version number from (I have no android studio installed).

@m4gr3d
Copy link
Collaborator Author

m4gr3d commented Mar 31, 2020

@NeoSpark314 I should probably include steps to install a specific version of the NDK, and add that version to the gradle build file to avoid errors like the one you ran into.

@m4gr3d
Copy link
Collaborator Author

m4gr3d commented Mar 31, 2020

@NeoSpark314 Did you use version 21.0.6... as the module ndk version?

@NeoSpark314
Copy link
Collaborator

@m4gr3d yes; I used

android {
    ndkVersion "21.0.6113669"
...
} 

…v1 architecture.

This transforms the original project into an Android library project, which has the nice side effect of simplifying integration with Android Studio and gradle.
@m4gr3d
Copy link
Collaborator Author

m4gr3d commented Mar 31, 2020

@NeoSpark314 I've updated the README and the gradle build file to specific the NDK version (version 21.0.6113669)

@m4gr3d m4gr3d merged commit 06f382b into GodotVR:master Apr 1, 2020
@m4gr3d m4gr3d deleted the 2.0 branch April 1, 2020 00:58
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Version 2.0
2 participants