Skip to content

Re-architecture of the Godot Android plugin.

Created by: m4gr3d

This PR revisits the Godot Android plugins' architecture. This is done by leveraging the Android library file format. A Godot Android plugin is now defined as follow:

A Godot Android plugin is a regular Android library packaged as an aar archive file with the following caveats:

  • The library must have a dependency on the Godot Android library (godot-lib.aar). A stable version is made available for each release.

  • The library must include a <meta-data> tag in its manifest file setup as follow: <meta-data android:name="org.godotengine.plugin.v1.[PluginName]" android:value="[plugin.init.ClassFullName]" /> Where:

  • PluginName is the name of the plugin.

  • plugin.init.ClassFullName is the full name (package + class name) of the plugin class extending GodotPlugin.

At runtime, Godot (via GodotPluginRegistry) will parse the Android manifest, and retrieve all components with the specified <meta-data> tag. It'll then use reflection to instantiate and load the plugin class defined by plugin.init.ClassFullName. From there, the plugins follow the same lifecycle as with the previous architecture.

A nice side-effect of this new architecture is that we can remove all the gradle build and android manifest custom update logic, since we can just rely on the Android library build and manifest merge mechanism.

Documentation update: https://github.com/godotengine/godot-docs/pull/2979

Note:

  • This is a breaking / non-backward compatible change with the previous Godot Android plugin architecture.
  • Just like the previous architecture, this requires the use of custom builds.
  • This new architecture may be helpful for PR #26221, as the ARCore build dependencies no longer need to be included in Godot core. This would however limit ARCore to custom builds only.
  • The updated architecture simplifies the process of bundling Android gdnative libraries with Android java libraries. See the updated documentation for details.

Example implementation:

Merge request reports