Android gear vr shipping distribution package fail

The error only happen when I’m packaged the game with setting like:

  • build configuration = shipping
  • for distribution = true
  • remove oculus signature files from distribution = true

The error happen because it was trying to do entitlement check (when “for distribution” & “remove oculus signature files from distribution” are true) but can’t find com.oculus.svclib.
Can someone help me how to solve this?

Below are the snipped log where the error happen:

ATHelper: Packaging (Android (ASTC)): -compile:
UATHelper: Packaging (Android (ASTC)):     [javac] Compiling 50 source files to E:\Unreal Projects\Train2Fall\Intermediate\Android\APK\bin\classes
UATHelper: Packaging (Android (ASTC)):     [javac] E:\Unreal Projects\Train2Fall\Intermediate\Android\APK\src\com\epicgames\ue4\GameActivity.java:529: error: package com.oculus.svclib does not exist
UATHelper: Packaging (Android (ASTC)):     [javac]                 com.oculus.svclib.OVREntitlementChecker.doAutomatedCheck(this);
UATHelper: Packaging (Android (ASTC)):     [javac]                                  ^
UATHelper: Packaging (Android (ASTC)):     [javac] Note: Some input files use or override a deprecated API.
UATHelper: Packaging (Android (ASTC)):     [javac] Note: Recompile with -Xlint:deprecation for details.
UATHelper: Packaging (Android (ASTC)):     [javac] 1 error
UATHelper: Packaging (Android (ASTC)): BUILD FAILED
UATHelper: Packaging (Android (ASTC)): D:\NVPACK\android-sdk-windows\tools\ant\build.xml:716: The following error occurred while executing this line:
UATHelper: Packaging (Android (ASTC)): D:\NVPACK\android-sdk-windows\tools\ant\build.xml:730: Compile failed; see the compiler error output for details.
UATHelper: Packaging (Android (ASTC)): Total time: 21 seconds
UATHelper: Packaging (Android (ASTC)): Program.Main: ERROR: AutomationTool terminated with exception: System.IO.FileNotFoundException: Could not find file 'E:\Unreal Projects\Train2Fall\Intermediate/Android/APK/bin/BoldExperience-release.apk'.
UATHelper: Packaging (Android (ASTC)): File name: 'E:\Unreal Projects\Train2Fall\Intermediate/Android/APK/bin/BoldExperience-release.apk'
UATHelper: Packaging (Android (ASTC)):    at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
UATHelper: Packaging (Android (ASTC)):    at System.IO.File.InternalCopy(String sourceFileName, String destFileName, Boolean overwrite, Boolean checkHost)
UATHelper: Packaging (Android (ASTC)):    at UnrealBuildTool.UEDeployAndroid.MakeApk(AndroidToolChain ToolChain, String ProjectName, String ProjectDirectory, String OutputPath, String EngineDirectory, Boolean bForDistribution, String CookFlavor, Boolean bMakeSeparateApks, Boolean bIncrementalPackage, Boolean bDisallowPackagingDataInApk)
UATHelper: Packaging (Android (ASTC)):    at UnrealBuildTool.UEDeployAndroid.PrepForUATPackageOrDeploy(FileReference ProjectFile, String ProjectName, String ProjectDirectory, String ExecutablePath, String EngineDirectory, Boolean bForDistribution, String CookFlavor, Boolean bIsDataDeploy)
UATHelper: Packaging (Android (ASTC)):    at AndroidPlatform.Package(ProjectParams Params, DeploymentContext SC, Int32 WorkingCL)
UATHelper: Packaging (Android (ASTC)):    at Project.Package(ProjectParams Params, Int32 WorkingCL)
UATHelper: Packaging (Android (ASTC)):    at BuildCookRun.DoBuildCookRun(ProjectParams Params)
UATHelper: Packaging (Android (ASTC)):    at AutomationTool.BuildCommand.Execute()
UATHelper: Packaging (Android (ASTC)):    at AutomationTool.Automation.Execute(List`1 CommandsToExecute, CaselessDictionary`1 Commands)
UATHelper: Packaging (Android (ASTC)):    at AutomationTool.Automation.Process(String[] Arguments)
UATHelper: Packaging (Android (ASTC)):    at AutomationTool.Program.MainProc(Object Param)
UATHelper: Packaging (Android (ASTC)):    at AutomationTool.InternalUtils.RunSingleInstance(Func`2 Main, Object Param)
UATHelper: Packaging (Android (ASTC)):    at AutomationTool.Program.Main()
UATHelper: Packaging (Android (ASTC)): Program.Main: AutomationTool exiting with ExitCode=1 (Error_Unknown)
UATHelper: Packaging (Android (ASTC)): BUILD FAILED
PackagingResults:Error: Error Unknown Error

I’m still in 4.12.4, but for me the issue was caused by a stale dependency in GearVR_APL.xml

If you force the OSIG files to be removed, GearVR_APL.xml adds an entitlement check to GameActivity.java. Unfortunately, that entitlement check uses com.oculus.svclib, which Oculus removed from their mobile libs back in June or so.

To get rid of the stale dependency, go to GearVR_APL.xml and comment out this line:

			com.oculus.svclib.OVREntitlementChecker.doAutomatedCheck(this);

Alternatively, you could just disable the “remove OSIG files” option and manually delete all the OSIG files in UE4\Engine\Build\Android\Java\assets before making a build.

Oops, a better fix would be to just force bEntitlementCheck to false in GearVR_APL.xml.

But, from what I know the entitlementcheck is required for submitting to oculus store… Does it means I must do the entitlementcheck manually? If it is, then, how to do it?

In OVR Platform 1.7 I see that Oculus has provided their own UE4 plugin, so you can use that as an example. If you’d rather not dabble in C++, there’s a a VerifyEntitlement blueprint function that you can use. It will asynchronously report entitlement success or failure via events. I haven’t used it myself, since I had already written our own entitlement check in C++, but you can give it a try.

Thanks for the information. I’m trying to find it from blueprint (verify entitlement check blueprint function), but can’t find it anywhere… It seems I must add the latest OVR platform SDK plugin manually first, and I’m not so sure because I’m using the binary version. But let me try it first.

Btw, this is still relevant to UE 4.21.1 :frowning: I can’t believe neither Epic nor Oculus bother fixing it.

Location of GearVR_APL.xml is different in UE 4.21.1 - it’s located in …\Engine\Plugins\Runtime\Oculus\OculusVR\Source\OculusHMD

Very nasty… have to remember this with every engine update!!

Why is this still a bug in 4.22? In order to package an Oculus Quest app I need hack through a GearVR xml file

This fix does still seem to be the only solution…

For UE4.23 Preview 6, the xml file is renamed from GearVR_APL.xml to OculusMobile_APL.xml.

Commenting the line from that xml solves this issue.