x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

[BUG] If .bash_profile file on OS X has JAVA_HOME environment variable, Android build fails in UE 4.10

I was trying to build an Android APK for Gear VR, and the build process kept failing, stating the following:

 MainFrameActions: Packaging (Android (ETC2)): mono: ====1/14/2016 2:13:51 AM====PERFORMING FINAL APK PACKAGE OPERATION================================================
 MainFrameActions: Packaging (Android (ETC2)): mono: Making .apk with Ant... (note: it's safe to ignore javac obsolete warnings)
 MainFrameActions: Packaging (Android (ETC2)): mono: Error: JAVA_HOME is not defined correctly.
 MainFrameActions: Packaging (Android (ETC2)): mono:   We cannot execute $(/System/Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home)/bin/java
 MainFrameActions: Packaging (Android (ETC2)): mono: UnrealBuildTool Exception: ERROR: /bin/sh failed with args -c '"/Android_TADP/NVPACK/apache-ant-1.8.2/bin/ant" -quiet debug'
 MainFrameActions: Packaging (Android (ETC2)): CommandUtils.Run: Run: Took 6.428365s to run mono, ExitCode=5
 MainFrameActions: Packaging (Android (ETC2)): BuildCommand.Execute: ERROR: BUILD FAILED
 MainFrameActions: Packaging (Android (ETC2)): Program.Main: ERROR: AutomationTool terminated with exception:
 MainFrameActions: Packaging (Android (ETC2)): Program.Main: ERROR: Exception in AutomationUtils.Automation: Command failed (Result:5): /Users/Shared/UnrealEngine/4.10/Engine/Binaries/DotNET/UnrealBuildTool.exe "/Users/jonathandaley/Documents/Unreal Projects/VRNavTutorial/VRNavTutorial.uproject" Android Development -prepfordeploy -rocket -nocreatestub -NoHotReloadFromIDE -ignorejunk. See logfile for details: 'UnrealBuildTool-2016.01.14-02.13.44.txt' 
 MainFrameActions: Packaging (Android (ETC2)): Stacktrace:   at AutomationTool.CommandUtils.RunAndLog (System.String App, System.String CommandLine, System.String Logfile, Int32 MaxSuccessCode, System.String Input, ERunOptions Options, System.Collections.Generic.Dictionary`2 EnvVars) [0x00000] in <filename unknown>:0 
 MainFrameActions: Packaging (Android (ETC2)):   at AutomationTool.CommandUtils.RunAndLog (AutomationTool.CommandEnvironment Env, System.String App, System.String CommandLine, System.String LogName, Int32 MaxSuccessCode, System.String Input, ERunOptions Options, System.Collections.Generic.Dictionary`2 EnvVars) [0x00000] in <filename unknown>:0 
 MainFrameActions: Packaging (Android (ETC2)):   at AutomationTool.CommandUtils.RunUBT (AutomationTool.CommandEnvironment Env, System.String UBTExecutable, System.String CommandLine, System.String LogName, System.Collections.Generic.Dictionary`2 EnvVars) [0x00000] in <filename unknown>:0 
 MainFrameActions: Packaging (Android (ETC2)):   at AndroidPlatform.PostBuildTarget (AutomationTool.UE4Build Build, System.String ProjectName, System.String UProjectPath, System.String Config) [0x00000] in <filename unknown>:0 
 MainFrameActions: Packaging (Android (ETC2)):   at AutomationTool.UE4Build.BuildWithUBT (System.String ProjectName, System.String TargetName, UnrealTargetPlatform TargetPlatform, System.String Config, System.String UprojectPath, Boolean ForceMonolithic, Boolean ForceNonUnity, Boolean ForceDebugInfo, Boolean ForceFlushMac, Boolean DisableXGE, System.String InAddArgs, Boolean ForceUnity, System.Collections.Generic.Dictionary`2 EnvVars) [0x00000] in <filename unknown>:0 
 MainFrameActions: Packaging (Android (ETC2)):   at AutomationTool.UE4Build.Build (AutomationTool.BuildAgenda Agenda, Nullable`1 InDeleteBuildProducts, Boolean InUpdateVersionFiles, Boolean InForceNoXGE, Boolean InUseParallelExecutor, Boolean InForceNonUnity, Boo
 MainFrameActions: Packaging (Android (ETC2)): lean InForceUnity, Boolean InShowProgress, System.Collections.Generic.Dictionary`2 PlatformEnvVars) [0x00000] in <filename unknown>:0 
 MainFrameActions: Packaging (Android (ETC2)):   at Project.Build (BuildCommand Command, AutomationTool.ProjectParams Params, Int32 WorkingCL) [0x00000] in <filename unknown>:0 
 MainFrameActions: Packaging (Android (ETC2)):   at BuildCookRun.DoBuildCookRun (AutomationTool.ProjectParams Params) [0x00000] in <filename unknown>:0 
 MainFrameActions: Packaging (Android (ETC2)):   at BuildCookRun.ExecuteBuild () [0x00000] in <filename unknown>:0 
 MainFrameActions: Packaging (Android (ETC2)):   at BuildCommand.Execute () [0x00000] in <filename unknown>:0 
 MainFrameActions: Packaging (Android (ETC2)): Program.Main: AutomationTool exiting with ExitCode=5
 MainFrameActions: Packaging (Android (ETC2)): Domain_ProcessExit
 MainFrameActions: Packaging (Android (ETC2)): RunUAT ERROR: AutomationTool was unable to run successfully.
 PackagingResults:Error: Error Unknown Error

The key part being:

     MainFrameActions: Packaging (Android (ETC2)): mono: Error: JAVA_HOME is not defined correctly.
     MainFrameActions: Packaging (Android (ETC2)): mono:   We cannot execute $(/System/Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home)/bin/java
     MainFrameActions: Packaging (Android (ETC2)): mono: UnrealBuildTool Exception: ERROR: /bin/sh failed with args -c '"/Android_TADP/NVPACK/apache-ant-1.8.2/bin/ant" -quiet debug'

After much searching on the AnswerHub, and lots of tinkering, it turns out that if you have a JAVA_HOME environment variable in the .bash_profile file on OS X, the Android build will fail. When I commented out that environment variable, it built just fine.

Product Version: UE 4.10
Tags:
more ▼

asked Jan 14 '16 at 07:26 AM in Bug Reports

avatar image

JonathanADaley
644 37 49 78

avatar image Samantha Sutton ♦♦ STAFF Jan 15 '16 at 09:09 PM

Jonathan,

I was unable to replicate this. What exactly needs to be within your .bash_profile file in order to make this happen. Does it have to be set up a specific way?

Looking forward to hearing back from you, thanks!

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

Hey Jonathan,

We have not heard back from you in a few days, so we are marking this post as Resolved for tracking purposes. If you are still experiencing the issue you reported, please respond to this message with additional information and we will offer further assistance.

Thank you!

more ▼

answered Jan 19 '16 at 09:11 PM

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question