Resolving build fail triggered by ARCore unity extension when building for oculus

I am working on a project that targets both Oculus and Mobile AR with ARCore’s geosocial functionality enabled. I have the project setup with both ARCore and Oculus installed in the XR management settings. My current process is to disable ARCore when building for the Oculus and vice versa. When I am building for Oculus, if I try build & run, the build fails with the following error:

Error building Player: ARCoreLoader is not enabled! To ensure Extensions SDK can work properly on Android Platform, navigate to ‘Project Settings > XR Plug-in Management’, switch to Android tab and check ‘ARCore’ as the Plug-in Provider.

But I am able to build the apk when I use build, Though that error still happens. Digging into the arcore-unity-extensions package, they have a check to see if the ARCore loader is enabled in XRMangement (See AndroidSupportPreprocessBuild.cs)

From my understanding of how the build process works, the IPreprocessBuildWithReport in the project always gets called and it’s not exactly possible to disable a package when building.

Is there any alternatives to how I can handle this situation where I have to manage different conflicting build processes? Or is it simply impossible to do?

Previously asked in: Resolving build fail triggered by ARCore unity extension when building for oculus

This is great feedback-- please pass on to Google! Unity is not affiliated with the ARCore Extensions package

Yep, created an issue on their end as well. I was wondering if there was something on Unity’s end to manage this, such as suppressing some of the callbacks or excluding packages from builds?

Not that I know of. The only way to remove the package from the build would be to modify your project manifest and completely remove the package from your project, but then any of your code dependent on the package would fail to compile and the build would fail.

Theoretically you could write your entire app using a version define so that it compiles whether or not ARCore Extensions is present, but this is not recommended. The better solution would be for Google to fix the issue and meanwhile to avoid the Build and Run button I think.

I see, thank you.

Out of sheer curiosity, would this be something unity is planning on supporting at some point?

I’m but a humble developer on the XR team, so I can’t speak with authority about Unity at large. My guess is that we have no plans to support conditional removal of packages based on build target. The more general solution to this problem would be to use preprocessor directives, but you’re in a difficult position because you don’t control the offending code.

1 Like

I have the same problem, using Oculus, Pico and ARCore SDKs, switching to build for every platform.
The Problem is also, ARCore really requires to be enabled and i even don’t know where this error message is coming from, to be able to deactivate it and to build for the Oculus or Pico Platform.

fyi, I also have a issue open on their repo: Build fail in multi-platform (oculus VR/ mobile AR) project · Issue #99 · google-ar/arcore-unity-extensions · GitHub