Fails to package GoogleVR for Android 4.x

I’ve tried to package a CardBoard project that will run on Android 4 or 4.4 and onwards.
Project settings-APK packaging- Minimum SDK v and Target SDK both at 9,
Android-SDK SDK API Level and NDK APi Level both.
It packages fine, but once I activate the VR plugin it fails unless SDK API and NDK API are android-21.
The finished apk then won’t install on my 4.4 phone. Is it possible to package a cardboard project to android 4.x?

Hey Magnvs,

Kitkat should work for Cardboard on Android 19 or 21. The documentation says to use Android-21 though, but I have deployed VR projects using recently.

Please upload your error output logs as a .txt file, thanks!

[ VR Quick Start][1]

https://docs.unrealengine.com/latest/INT/Platforms/GoogleVR/QuickStart/index.html

Hi,
Thanks for your response.

I asked the same question on the forums and someone said Cardboard was only supported by API-21. Mine fails immediately with 19 rather than 21. What engine version did you package with?
I will upload output logs once I get home.

-M

Hi, I’m uploading my log from my attempt just now.[link text][1]
And also my codeworks install.
This is a Win 10 64bit comp (somehow UE4 installed itself as 32 bit though), using 64 bit codeworks.
6700k i7 cpu, nvidia 1080 vid, 32gb ram. UE running from ssd.

Magnvs,

If you’re using GoogleVR, you could mean Daydream or Cardboard. Please make sure you specify which you’re using.

Android 23 and 24 should be working fine in 4.14.0 which just released today. Try updating to 4.14.0. Keep in mind that 1R5 Codeworks isn’t installing Android 23 or 24 by default.

Thanks!

Advanced APKPackaging is set to Cardboard deployment mode.
I followed the guide on https://docs.unrealengine.com/latest/INT/Platforms/GoogleVR/QuickStart/index.html but it appears to be a little dated and I’m not sure whether it focuses on Cardboard or Daydream…

I packaged with the 4.14 preview earlier, but it wouldn’t complete Android 19.

Which version of Codeworks are you using? Is it 1R5? 1R4u2?

Have you tried upgrading to Android-21, or using Android-23 or 24 in the release of 4.14.0 as stated above?

For updated information and community guides, I’d suggest the [forums][1] if you’ve not looked there either.

https://forums.unrealengine.com/forumdisplay.php?27-VR-Development

I installed 1R5 yesterday and made a new test project on UE 4.14, same as before; It packages in 21 but not 19, I’m not sure about 23 or 24 because the config screen clearly says 21 and later won’t install on Android 4.4 so it’s of no use to me. Packaged 21 will not install on my 4.4 test devices.

Can you please verify that you’ve installed everything under Android 4.4.2 (API 19) from CodeWorks?

Hi, I’m in the same boat as you are (i.e. trying to get a VR test app to build against KitKat / API level 19), but after reviewing the build log and a bit of grepping around the files, I’ve found a way to get the project to work on KitKat devices (and yes, the resulting app is indeed functional as intended on my test device).


The symptom:

UATHelper: Packaging (Android (ATC)): UnrealBuildTool:      [aapt] X:\ue4projects\PROJECTNAME\Intermediate\Android\APK\JavaLibs\common_library\res\values-v21\values.xml:5: error: Error retrieving parent for item: No resource found that matches the given name '@android:style/Theme.Material.Light.Dialog'.
.
.
.
UATHelper: Packaging (Android (ATC)): BUILD FAILED
PackagingResults:Error: Error Unknown Error

(Here’s some log context to assist in identification for anyone stumped by the same issue)

UATHelper: Packaging (Android (ATC)): UnrealBuildTool: -code-gen:
UATHelper: Packaging (Android (ATC)): UnrealBuildTool: [mergemanifest] Found Deleted Target File
UATHelper: Packaging (Android (ATC)): UnrealBuildTool: [mergemanifest] Merging AndroidManifest files into one.
UATHelper: Packaging (Android (ATC)): UnrealBuildTool: [mergemanifest] Manifest merger disabled. Using project manifest only.
UATHelper: Packaging (Android (ATC)): UnrealBuildTool:      [echo] Handling aidl files...
UATHelper: Packaging (Android (ATC)): UnrealBuildTool:      [aidl] No AIDL files to compile.
UATHelper: Packaging (Android (ATC)): UnrealBuildTool:      [echo] ----------
UATHelper: Packaging (Android (ATC)): UnrealBuildTool:      [echo] Handling RenderScript files...
UATHelper: Packaging (Android (ATC)): UnrealBuildTool:      [echo] ----------
UATHelper: Packaging (Android (ATC)): UnrealBuildTool:      [echo] Handling Resources...
UATHelper: Packaging (Android (ATC)): UnrealBuildTool:      [aapt] Generating resource IDs...
UATHelper: Packaging (Android (ATC)): UnrealBuildTool:      [aapt] X:\ue4projects\PROJECTNAME\Intermediate\Android\APK\JavaLibs\common_library\res\values-v21\values.xml:5: error: Error retrieving parent for item: No resource found that matches the given name '@android:style/Theme.Material.Light.Dialog'.
UATHelper: Packaging (Android (ATC)): UnrealBuildTool:      [aapt] 
UATHelper: Packaging (Android (ATC)): UnrealBuildTool: 
UATHelper: Packaging (Android (ATC)): UnrealBuildTool: BUILD FAILED
UATHelper: Packaging (Android (ATC)): UnrealBuildTool: X:\\android-sdk-windows\tools\ant\build.xml:597: The following error occurred while executing this line:
UATHelper: Packaging (Android (ATC)): UnrealBuildTool: X:\\android-sdk-windows\tools\ant\build.xml:649: The following error occurred while executing this line:
UATHelper: Packaging (Android (ATC)): UnrealBuildTool: X:\\android-sdk-windows\tools\ant\build.xml:694: null returned: 1
UATHelper: Packaging (Android (ATC)): UnrealBuildTool: 
UATHelper: Packaging (Android (ATC)): UnrealBuildTool: Total time: 28 seconds
UATHelper: Packaging (Android (ATC)): UnrealBuildTool: UnrealBuildTool Exception: System.IO.FileNotFoundException: Could not find file 'X:\ue4projects\PROJECTNAME\Intermediate/Android/APK/bin/PROJECTNAME-debug.apk'.
UATHelper: Packaging (Android (ATC)): UnrealBuildTool: File name: 'X:\ue4projects\PROJECTNAME\Intermediate/Android/APK/bin/PROJECTNAME-debug.apk'
UATHelper: Packaging (Android (ATC)): UnrealBuildTool:    at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
UATHelper: Packaging (Android (ATC)): UnrealBuildTool:    at System.IO.File.InternalCopy(String sourceFileName, String destFileName, Boolean overwrite, Boolean checkHost)
UATHelper: Packaging (Android (ATC)): UnrealBuildTool:    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 (ATC)): UnrealBuildTool:    at UnrealBuildTool.UEDeployAndroid.PrepTargetForDeployment(UEBuildTarget InTarget)
UATHelper: Packaging (Android (ATC)): UnrealBuildTool:    at UnrealBuildTool.UnrealBuildTool.DoPostStartupStuffThatCanAccessConfigs(String[] Arguments)
UATHelper: Packaging (Android (ATC)): CommandUtils.Run: Run: Took 134.4116879s to run UnrealBuildTool.exe, ExitCode=5
UATHelper: Packaging (Android (ATC)): Program.Main: ERROR: AutomationTool terminated with exception: AutomationTool.CommandUtils+CommandFailedException: Command failed (Result:5): X:\Epic Games\4.14\Engine\Binaries\DotNET\UnrealBuildTool.exe PROJECTNAME Android Development -Project=X:\ue4projects\PROJECTNAME\PROJECTNAME.uproject  X:\ue4projects\PROJECTNAME\PROJECTNAME.uproject  -remoteini="X:\ue4projects\PROJECTNAME" -noxge -NoHotReload -ignorejunk. See logfile for details: 'UnrealBuildTool-2016.11.23-04.53.20.txt' 
UATHelper: Packaging (Android (ATC)):    at AutomationTool.CommandUtils.RunAndLog(String App, String CommandLine, String Logfile, Int32 MaxSuccessCode, String Input, ERunOptions Options, Dictionary`2 EnvVars, SpewFilterCallbackType SpewFilterCallback)
UATHelper: Packaging (Android (ATC)):    at AutomationTool.CommandUtils.RunAndLog(CommandEnvironment Env, String App, String CommandLine, String LogName, Int32 MaxSuccessCode, String Input, ERunOptions Options, Dictionary`2 EnvVars, SpewFilterCallbackType SpewFilterCallback)
UATHelper: Packaging (Android (ATC)):    at AutomationTool.CommandUtils.RunUBT(CommandEnvironment Env, String UBTExecutable, String CommandLine, String LogName, Dictionary`2 EnvVars)
UATHelper: Packaging (Android (ATC)):    at AutomationTool.CommandUtils.RunUBT(CommandEnvironment Env, String UBTExecutable, FileReference Project, String Target, String Platform, String Config, String AdditionalArgs, String LogName, Dictionary`2 EnvVars)
UATHelper: Packaging (Android (ATC)):    at AutomationTool.UE4Build.BuildWithUBT(String TargetName, UnrealTargetPlatform TargetPlatform, String Config, FileReference UprojectPath, Boolean ForceMonolithic, Boolean ForceNonUnity, Boolean ForceDebugInfo, Boolean ForceFlushMac, Boolean DisableXGE, String InAddArgs, Boolean ForceUnity, Dictionary`2 EnvVars)
UATHelper: Packaging (Android (ATC)):    at AutomationTool.UE4Build.Build(BuildAgenda Agenda, Nullable`1 InDeleteBuildProducts, Boolean InUpdateVersionFiles, Boolean InForceNoXGE, Boolean InUseParallelExecutor, Boolean InForceNonUnity, Boolean InForceUnity, Boolean InShowProgress, Dictionary`2 PlatformEnvVars, Nullable`1 InChangelistNumberOverride, Dictionary`2 InTargetToManifest)
UATHelper: Packaging (Android (ATC)):    at Project.Build(BuildCommand Command, ProjectParams Params, Int32 WorkingCL, ProjectBuildTargets TargetMask)
UATHelper: Packaging (Android (ATC)):    at BuildCookRun.DoBuildCookRun(ProjectParams Params)
UATHelper: Packaging (Android (ATC)):    at AutomationTool.BuildCommand.Execute()
UATHelper: Packaging (Android (ATC)):    at AutomationTool.Automation.Execute(List`1 CommandsToExecute, CaselessDictionary`1 Commands)
UATHelper: Packaging (Android (ATC)):    at AutomationTool.Automation.Process(String[] Arguments)
UATHelper: Packaging (Android (ATC)):    at AutomationTool.Program.MainProc(Object Param)
UATHelper: Packaging (Android (ATC)):    at AutomationTool.InternalUtils.RunSingleInstance(Func`2 Main, Object Param)
UATHelper: Packaging (Android (ATC)):    at AutomationTool.Program.Main()
UATHelper: Packaging (Android (ATC)): Program.Main: AutomationTool exiting with ExitCode=5 (5)
UATHelper: Packaging (Android (ATC)): BUILD FAILED
PackagingResults:Error: Error Unknown Error

It’s easy to miss it at first glance, but the root cause of the issue is that KitKat doesn’t provide the Material Design theme on its own (since that debuted later with Lollipop) so @android:style/Theme.Material.Light.Dialog cannot be resolved.

This can be worked around by replacing it with a theme that exists in KitKat, but not within the file mentioned in the error message - that’s merely a copy of another file that resides within the engine’s Source folder (and will therefore be clobbered the next time you try to package the app).

The actual file to modify is at X:\Path_To_Engine_Hierarchy\4.14\Engine\Source\ThirdParty\GoogleVR\lib\common_library\res\values-v21\values.xml, all you need to do is remove its read-only attribute (the usual right-click → Properties stuff) and edit it with a text editor, changing:

<style name="CardboardDialogTheme" parent="@android:style/Theme.Material.Light.Dialog"/>

To:

<style name="CardboardDialogTheme" parent="@android:style/Theme.Holo.Light.Dialog"/>

(and don’t forget to save the file :wink: )

With that change, subsequent package attempts should then succeed.

Bear in mind that this is merely a workaround and is not a proper solution. Caveat emptor.


For reference, I also made changes to the following project settings:

Platform - Android

Minimum SDK Version: 19

Target SDK Version: 21

(Configure GoogleVR Deployment Mode remained set at Daydream & Cardboard)

Platform - Android SDK

SDK API Level: android-21*

NDK API Level: android-21*

* As mentioned in 's comment below, if Target SDK Version is set to 21 then SDK API Level and NDK API Level should use android-21 and not android-19


Hope this helps, good luck.


It took me no less than 5 edit attempts to actually get the entire answer to show up, ergh. Please properly escape the greater/less than characters so messages don’t get truncated, site admins. Thanks.

SlipStream7800,

You should not use as your SDK and NDK API Levels if your target SDK is 21. Please adjust it to Android-21.

Thank you!

Ah, I was not aware of that restriction (not familiar with Android development), many thanks for correcting me. :slight_smile:

I’ll edit my answer to reflect it as well.

You’re welcome. Let me know if you are still running into issues. :smiley:

I will try to install Intel x96 Atom system image and ARM EABI v7 tonight, currently it seems only the SDK Platform was installed by default.

Thanks, but if I set SDK and NDK to 21 it will always compile successfully, however it will not install on a 4.4 device.
Does the workaround you describe allow Level 21 packages to install on Kitkat devices?

Hmm, I’m getting the same issue as you are when I set SDK and NDK to 21 (the installer batch script reports Failure [INSTALL_FAILED_OLDER_SDK] on my KitKat device).

I went ahead and decompiled both the older (i.e. 19/21/19/19 MinSDK/TargetSDK/SDKAPI/NDKAPI) and newer (i.e. 19/21/21/21 MinSDK/TargetSDK/SDKAPI/NDKAPI) APKs to compare their AndroidManifest.xml and apktool.yml files. Here’s the relevant differences that I found:


Older APK:

apktool.yml

sdkInfo:
  minSdkVersion: '19'
  targetSdkVersion: '21'

AndroidManifest.xml

<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:installLocation="internalOnly" package="com.YourCompany.PROJECTNAME" platformBuildVersionCode="19" platformBuildVersionName="4.4.2-1456859">

I’m not really familiar with the Android build process, but I’m guessing it’s targeting 19 due to me specifying android-19 for the SDK and NDK API levels.


Newer APK:

apktool.yml

sdkInfo:
  minSdkVersion: '21'
  targetSdkVersion: '21'

minSdkVersion: ‘21’ despite being explicitly set to 19 in project settings? What’s going on here? :S

AndroidManifest.xml

<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:installLocation="internalOnly" package="com.YourCompany.PROJECTNAME" platformBuildVersionCode="21" platformBuildVersionName="5.0.1-1624448">

Probably targeting 21 due to me specifying android-21 for the SDK and NDK API levels.


Digging around the files in the PROJECTNAME\Intermediate\Android folder, I found -armv7_-es2_AndroidManifest.xml, which contains:

<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="21" />

What, 21 for minSdkVersion? But that makes no sense - I explicitly set that to 19 (and I even double-checked my project settings again)?


TL;DR

So I guess it seems like it’s being forced to API level 21 either by the Android build tools, or by UE4, but I have no idea which component is responsible for this. :confused:

So when you’re on kitkat, you need to use. Android-21 is going to cause trouble even if you lower the minimum to and the Maximum to Android-21. It’ll still throw out a failure because kitkat doesn’t support Android-21 as it’s for lollipop. If you use though, it’ll work for kitkat.

Right, but Android 19 will not package unless the VR is disabled, that’s what the question is about.

Yes, that is indeed the issue. Something seems to be implicitly forcing minSdkVersion from 19 back to 21 again, though I don’t know what.

GoogleVR will need the Android SDK set to 21, Daydream is at 24. 19 is for GearVR. Sorry for any confusion. Please adjust your settings in your project settings so that it’ll package correctly.

Thanks!