godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
91.16k stars 21.19k forks source link

Exporting to Oculus Quest 2 APK fails #67378

Closed mgrigajtis closed 2 years ago

mgrigajtis commented 2 years ago

Godot version

4.0 master branch

System information

Windows 11, NVIDIA 3060, Vulkan Mobile

Issue description

When attempting to export (or run) for Oculus Quest 2, the build fails when checking for duplicate classes. Oddly enough, the official beta release 2 still works.

Output below:

Starting a Gradle Daemon, 1 incompatible and 1 stopped Daemons could not be reused, use --status for details WARNING:We recommend using a newer Android Gradle plugin to use compileSdk = 32

This Android Gradle plugin (7.0.3) was tested up to compileSdk = 31

This warning can be suppressed by adding android.suppressUnsupportedCompileSdk=32 to this project's gradle.properties

The build will continue, but you are strongly encouraged to update your project to use a newer Android Gradle Plugin that has been tested with compileSdk = 32

Task :clean UP-TO-DATE Task :assetPacks:installTime:clean UP-TO-DATE Task :preBuild UP-TO-DATE Task :preDebugBuild UP-TO-DATE Task :compileDebugAidl NO-SOURCE Task :compileDebugRenderscript NO-SOURCE Task :generateDebugBuildConfig Task :generateDebugResValues Task :generateDebugResources Task :checkDebugAarMetadata Task :createDebugCompatibleScreenManifests Task :extractDeepLinksDebug

Task :processDebugMainManifest [godot-lib.debug.aar] C:\Users\matth.gradle\caches\transforms-3\cf7ae2ec09238bef6db7db8a479e5c5f\transformed\jetified-godot-lib.debug\AndroidManifest.xml Warning: Package name 'org.godotengine.godot' used in: godot-lib.debug.aar, godot-lib.template_debug.aar. D:\Godot 4 Projects\Silver Moon\android\build\src\debug\AndroidManifest.xml:11:5-134 Warning: uses-feature#android.hardware.vr.headtracking was tagged at AndroidManifest.xml:11 to replace another declaration but no other declaration present

Task :processDebugManifest Task :mergeDebugNativeDebugMetadata NO-SOURCE Task :javaPreCompileDebug Task :mergeDebugShaders Task :compileDebugShaders NO-SOURCE Task :generateDebugAssets UP-TO-DATE Task :mergeDebugResources Task :mergeDebugAssets Task :processDebugJavaRes NO-SOURCE Task :checkDebugDuplicateClasses FAILED Task :mergeDebugJniLibFolders Task :processDebugManifestForPackage Task :desugarDebugFileDependencies Task :compressDebugAssets

FAILURE: Build failed with an exception.

BUILD FAILED in 16s 18 actionable tasks: 16 executed, 2 up-to-date

Exit Code: 1

Steps to reproduce

Clone the Godot 4 Open XR example project (https://github.com/BastiaanOlij/godot4_openxr_demo), configure for Oculus Quest 2, attempt to export or run.

Minimal reproduction project

https://github.com/BastiaanOlij/godot4_openxr_demo

akien-mga commented 2 years ago

Related to https://github.com/godotengine/godot/pull/66935 which changed the name of the debug AAR lib (.debug.aar -> .template_debug.aar). I noticed this too while building beta 3 yesterday, I'm not sure this was a necessary change, and it likely breaks compat for existing plugins. @m4gr3d

BastiaanOlij commented 2 years ago

That would indeed explain it and that would totally suck, because we can now either choose between working plugins in beta 2, or working plugins in master, not both... :)

Once this change is in a beta build we'll update the name in the plugin.

BastiaanOlij commented 2 years ago

@m4gr3d btw, does this also mean that we have a problem if we mix a debug build of the plugin with a runtime and vise versa seeing the name of the library it expects will be different? Thats probably an existing issue atm even with the old names... Or am I missing something?

akien-mga commented 2 years ago

For the record, I have built 4.0-beta3 and I'm about to release it, which includes #66935.

So plugins will likely need to be changed for beta3+ indeed. And if we decide to go back to the old name in beta4 then we'll have to change again. But well it's beta and early days for most Android plugins for Godot 4.0 so it's probably not too big a deal.

mgrigajtis commented 2 years ago

Is there anything I have to do to get it to build locally, or will it be fixed in the master branch soon?

BastiaanOlij commented 2 years ago

@mgrigajtis if I understand the problem correctly it's just a matter of adjusting the godot-lib entry here: https://github.com/GodotVR/godot_openxr_loaders/blob/master/godotopenxrmeta/build.gradle#L42

BastiaanOlij commented 2 years ago

Well I tried this and it didn't fix the problem for me so there is more to this....

Also @akien-mga , we only put the release build of the lib as part of our releases. As a result I'm currently just including the release build of the godot-lib (I was before in beta2 as well and that worked). The AAR plugin system currently doesn't even allow identifying release builds and debug builds so I'm not even sure how this is supposed to work.

So yeah I'm a bit stumped as to what the correct fix it.

Anyway, the change I'm currently working on is: https://github.com/GodotVR/godot_openxr_loaders/pull/12

konczg commented 2 years ago

@mgrigajtis @BastiaanOlij @akien-mga I was able to reproduce the issue locally. The cause of this bug was that the Godot source was updated without cleaning the workspace, so that it contained the previously built Android libraries with the old target names (which, I suppose, is included in the apk through an include: ['*.aar']). To make exporting to Android work, make sure that the source folder is clean before building Godot, and that the Android build templates are reimported into the project.

BastiaanOlij commented 2 years ago

owh thats nuts! that hasn't bit me in the **** for a while...

BastiaanOlij commented 2 years ago

@konczg actually, my source folder is clean, if by the source folder you mean res://android/build. It was duplicated in my android_source.zip.

Running gradlew clean in platform/android/java doesn't seem to do a full job cleaning stuff up, I had to go manually into the build folders to clean up the old AARs so there is some room for improvement there.

konczg commented 2 years ago

@BastiaanOlij Yeah, the aar's in question seemed to be under platform/android/java. Sorry, by "cleaning" I meant a full git clean -xdf, that seemed to do the job for me :) (but always make sure first that there is no untracked change that needs to be kept)

BastiaanOlij commented 2 years ago

I'm very careful running git clean -xdf because it blows away my VSCODE setup :(

m4gr3d commented 2 years ago

Closing this issue as resolved.