GodotVR / godot_openxr_vendors

Godot 4 wrapper for OpenXR vendors loaders and extensions
MIT License
92 stars 19 forks source link

Manifest merger failed building for Quest 2 with 1.0.0 Alpha 2 #19

Closed Malcolmnixon closed 1 year ago

Malcolmnixon commented 1 year ago

I'm trying to export the godot-xr-tools demo project (4.0-dev) for Quest native. If I use 1.0.0 Alpha 1 the Gradle build works fine.

If instead I use the 1.0.0 Alpha 2 build, it fails with the following error:

Execution failed for task ':processReleaseMainManifest'.
> Manifest merger failed : Attribute meta-data#com.oculus.supportedDevices@value value=(all) from AndroidManifest.xml:55:13-32
    is also present at [godotopenxrmeta-debug.aar] AndroidManifest.xml:20:13-50 value=(quest|quest2|questpro).
    Suggestion: add 'tools:replace="android:value"' to <meta-data> element at AndroidManifest.xml:53:9-55:35 to override.
Malcolmnixon commented 1 year ago

The problem appears to be that godotopenxrmeta/src/main/AndroidManifest.xml contains the following entry:

        <meta-data
            android:name="com.oculus.supportedDevices"
            android:value="quest|quest2|questpro" />

However Godot 4 platform/android/java/app/AndroidManifest.xml contains the following conflicting entry:

        <!-- This is removed by the exporter if the xr mode is not VR. -->
        <meta-data
            android:name="com.oculus.supportedDevices"
            android:value="all" />

The Manifest Merger tool doesn't have enough information to resolve the conflict. There appears to be two ways of fixing this:

  1. Modify godot to put the new "quest|quest2|questpro" values in its manifest
  2. Give the Manifest Merger tool enough information to resolve the conflict

According to https://developer.android.com/studio/build/manage-manifests this can be done by:

  1. Adding xmlns:tools="http://schemas.android.com/tools" to the manifest namespaces
  2. Adding tools:node="replace" in the meta-data line to inform Manifest Merger which one should win
BastiaanOlij commented 1 year ago

As this meta entry is specific to Meta, I think it should be removed all together from the Godot 4 exporter (so removed from the manifest and the code that changes it removed from the export code). It's a left over from Godot 3 and we really don't want it there when exporting to other Android based XR devices.

I wonder if adding tools:node="replace" will result in it failing once we remove the entry from the main manifest. If so we might want to hold off and just make the changes in Godot, if not I'm for adding that here.

In the long term this does show an issue for exporting to XR. In the long run we hope that all vendors will use the Khronos loaders and the need for this repo will go away, but if different vendors require custom entries in the manifest file, we don't really have a way to configure that without hardcoding it in the exporter somewhere. @m4gr3d any ideas about where we're heading with this?

BastiaanOlij commented 1 year ago

Decision in XR meeting: