Error - Final APK package operation fails

Hi everyone, I currently develop an android game and I want to test touch inputs and some other functions in it. I prepaired everything in my Project Settings (in Android SDK), but when I want to package the project for Android, it always shows some errors in making the APK. Firstly it was showing some errors with the javac version (something like 51 is newer then 50), so I updated JDK up to date and I still have some other errors and warnings. Now it’s not with the version, but with something else. I decided to update Apache ANT, but the problem is still there… I don’t know what to do… I used SDK Manager to update all Android (and Google) parts, JDK and ANT are the newest version, but the output log shows this:


MainFrameActions: Packaging (Android (All)): ====27.4.2015 21:54:29====PERFORMING FINAL APK PACKAGE OPERATION================================================
MainFrameActions: Packaging (Android (All)): UEDeployAndroid.RunCommandLineProgramAndThrowOnError: Making .apk with Ant... (note: it's safe to ignore javac obsolete warnings)
MainFrameActions: Packaging (Android (All)):     [javac] warning: [options] source value 1.5 is obsolete and will be removed in a future release
MainFrameActions: Packaging (Android (All)):     [javac] warning: [options] target value 1.5 is obsolete and will be removed in a future release
MainFrameActions: Packaging (Android (All)):     [javac] warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
MainFrameActions: Packaging (Android (All)):     [javac] 3 warnings
MainFrameActions: Packaging (Android (All)):     [javac] warning: [options] source value 1.5 is obsolete and will be removed in a future release
MainFrameActions: Packaging (Android (All)):     [javac] warning: [options] target value 1.5 is obsolete and will be removed in a future release
MainFrameActions: Packaging (Android (All)):     [javac] warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
MainFrameActions: Packaging (Android (All)):     [javac] Note: Some input files use or override a deprecated API.
MainFrameActions: Packaging (Android (All)):     [javac] Note: Recompile with -Xlint:deprecation for details.
MainFrameActions: Packaging (Android (All)):     [javac] 3 warnings
MainFrameActions: Packaging (Android (All)): BUILD FAILED
MainFrameActions: Packaging (Android (All)): C:\NVPACK\android-sdk-windows	ools\ant\build.xml:932: The following error occurred while executing this line:
MainFrameActions: Packaging (Android (All)): C:\NVPACK\android-sdk-windows	ools\ant\build.xml:950: null returned: 1
MainFrameActions: Packaging (Android (All)): Total time: 43 seconds
MainFrameActions: Packaging (Android (All)): BuildCommand.Execute: ERROR: BUILD FAILED
MainFrameActions: Packaging (Android (All)): Program.Main: ERROR: AutomationTool terminated with exception:
MainFrameActions: Packaging (Android (All)): Program.Main: ERROR: Exception in UnrealBuildTool: ERROR: cmd.exe failed with args /c "C:/NVPACK/apache-ant-1.9.4/bin/ant.bat" -quiet debug
MainFrameActions: Packaging (Android (All)): Stacktrace:    v UnrealBuildTool.Android.UEDeployAndroid.RunCommandLineProgramAndThrowOnError(String WorkingDirecto
MainFrameActions: Packaging (Android (All)): ry, String Command, String Params, String OverrideDesc, Boolean bUseShellExecute)
MainFrameActions: Packaging (Android (All)):    v UnrealBuildTool.Android.UEDeployAndroid.MakeApk(String ProjectName, String ProjectDirectory, String OutputPath, String EngineDirectory, Boolean bForDistribution, String CookFlavor, Boolean bMakeSeparateApks, Boolean bIncrementalPackage, Boolean bDisallowPackagingDataInApk)
MainFrameActions: Packaging (Android (All)):    v UnrealBuildTool.Android.UEDeployAndroid.PrepForUATPackageOrDeploy(String ProjectName, String ProjectDirectory, String ExecutablePath, String EngineDirectory, Boolean bForDistribution, String CookFlavor, Boolean bIsDataDeploy)
MainFrameActions: Packaging (Android (All)):    v AndroidPlatform.Package(ProjectParams Params, DeploymentContext SC, Int32 WorkingCL)
MainFrameActions: Packaging (Android (All)):    v Project.Package(ProjectParams Params, Int32 WorkingCL)
MainFrameActions: Packaging (Android (All)):    v BuildCookRun.DoBuildCookRun(ProjectParams Params)
MainFrameActions: Packaging (Android (All)):    v BuildCommand.Execute()
MainFrameActions: Packaging (Android (All)):    v AutomationTool.Automation.Execute(List`1 CommandsToExecute, CaselessDictionary`1 Commands)
MainFrameActions: Packaging (Android (All)):    v AutomationTool.Automation.Process(String] CommandLine)
MainFrameActions: Packaging (Android (All)):    v AutomationTool.Program.MainProc(Object Param)
MainFrameActions: Packaging (Android (All)):    v AutomationTool.InternalUtils.RunSingleInstance(MainProc Main, Object Param)
MainFrameActions: Packaging (Android (All)):    v AutomationTool.Program.Main()
MainFrameActions: Packaging (Android (All)): Program.Main: ERROR: ERROR: cmd.exe failed with args /c "C:/NVPACK/apache-ant-1.9.4/bin/ant.bat" -quiet debug
MainFrameActions: Packaging (Android (All)): ProcessManager.KillAll: Trying to kill 0 spawned processes.
MainFrameActions: Packaging (Android (All)): Program.Main: AutomationTool exiting with ExitCode=1
MainFrameActions: Packaging (Android (All)): Domain_ProcessExit
MainFrameActions: Packaging (Android (All)): ProcessManager.KillAll: Trying to kill 0 spawned processes.
MainFrameActions: Packaging (Android (All)): copying UAT log files...
MainFrameActions: Packaging (Android (All)): RunUAT.bat ERROR: AutomationTool was unable to run successfully.
MainFrameActions: Packaging (Android (All)): BUILD FAILED

Here you can see, what I got in my Project Settings:

I have not built UE4 for android, but I have been doing Android for about 8 years. It looks to me your ANT config is incorrect. It’s a common thing to see compatibility issues between JDK version, ANT, and the Android SDK. First off, I would use the last JDK version 7. Try to stay away from JDK 8. If you are installing on Windows, try to install the programs in a separate folder, on your C drive. Do not install them under “Program Files”. The reason i say this is because the Android compiler sometimes gets confused with spacing in a folder name (expecially Proguard – it will always fail). Install to a folder that does NOT have whitespace.
If it was me, I would uninstall the Android SDK, JDK, Eclipse, Android Studio, and anything else you are using with Android. Then go and download an “all-in-one” installer for either Eclipse or Android studio. Let this installer load the correct software, versions, system PATH, etc… After that, repoint UE to the correct locations.
Hope this helps…

So I tried to relocate the JDK folder into the NVPACK folder and it didn’t seem to be the problem… It was still making some errors which make the building failed. So I tried to used the JDKv7 and the output log wrote this:


MainFrameActions: Packaging (Android (All)): ====29.4.2015 10:30:41====PERFORMING FINAL APK PACKAGE OPERATION================================================
MainFrameActions: Packaging (Android (All)): UEDeployAndroid.RunCommandLineProgramAndThrowOnError: Making .apk with Ant... (note: it's safe to ignore javac obsolete warnings)
LogActorComponent: UnregisterComponent: (/Engine/Transient.CharMoveComp) Not registered. Aborting.
LogParticles: Destroying 0 GPU particle simulations for FXSystem 0x000000001937D580
LogParticles: Destroying 0 GPU particle simulations for FXSystem 0x0000000028DCE0C0
LogSavePackage: Save=91.110703ms
LogSavePackage: Moving '../../../../../../Users//Documents/Unreal Projects/Ball 4.7/Saved/DefaultMenu_Auto17C62BA40401376B0A44A04BB14F28896.tmp' to '../../../../../../Users//Documents/Unreal Projects/Ball 4.7/Saved/Autosaves/Game/MyContent/levels/DefaultMenu_Auto1.umap'
LogFileHelpers: Editor autosave (incl. sublevels) for '/Game/MyContent/levels/DefaultMenu' took 0.447
LogFileHelpers: Editor autosave (incl. sublevels) for all levels took 0.447
MainFrameActions: Packaging (Android (All)):     [javac] Note: Some input files use or override a deprecated API.
MainFrameActions: Packaging (Android (All)):     [javac] Note: Recompile with -Xlint:deprecation for details.
MainFrameActions: Packaging (Android (All)): BUILD FAILED
MainFrameActions: Packaging (Android (All)): C:\NVPACK\android-sdk-windows	ools\ant\build.xml:932: The following error occurred while executing this line:
MainFrameActions: Packaging (Android (All)): C:\NVPACK\android-sdk-windows	ools\ant\build.xml:950: null returned: 1
MainFrameActions: Packaging (Android (All)): Total time: 1 minute 2 seconds
MainFrameActions: Packaging (Android (All)): BuildCommand.Execute: ERROR: BUILD FAILED
MainFrameActions: Packaging (Android (All)): Program.Main: ERROR: AutomationTool terminated with exception:
MainFrameActions: Packaging (Android (All)): Program.Main: ERROR: Exception in UnrealBuildTool: ERROR: cmd.exe failed with args /c "C:/NVPACK/apache-ant-1.9.4/bin/ant.bat" -quiet debug
MainFrameActions: Packaging (Android (All)): Stacktrace:    v UnrealBuildTool.Android.UEDeployAndroid.RunCommandLineProgramAndThrowOnError(String WorkingDirecto
MainFrameActions: Packaging (Android (All)): ry, String Command, String Params, String OverrideDesc, Boolean bUseShellExecute)
MainFrameActions: Packaging (Android (All)):    v UnrealBuildTool.Android.UEDeployAndroid.MakeApk(String ProjectName, String ProjectDirectory, String OutputPath, String EngineDirectory, Boolean bForDistribution, String CookFlavor, Boolean bMakeSeparateApks, Boolean bIncrementalPackage, Boolean bDisallowPackagingDataInApk)
MainFrameActions: Packaging (Android (All)):    v UnrealBuildTool.Android.UEDeployAndroid.PrepForUATPackageOrDeploy(String ProjectName, String ProjectDirectory, String ExecutablePath, String EngineDirectory, Boolean bForDistribution, String CookFlavor, Boolean bIsDataDeploy)
MainFrameActions: Packaging (Android (All)):    v AndroidPlatform.Package(ProjectParams Params, DeploymentContext SC, Int32 WorkingCL)
MainFrameActions: Packaging (Android (All)):    v Project.Package(ProjectParams Params, Int32 WorkingCL)
MainFrameActions: Packaging (Android (All)):    v BuildCookRun.DoBuildCookRun(ProjectParams Params)
MainFrameActions: Packaging (Android (All)):    v BuildCommand.Execute()
MainFrameActions: Packaging (Android (All)):    v AutomationTool.Automation.Execute(List`1 CommandsToExecute, CaselessDictionary`1 Commands)
MainFrameActions: Packaging (Android (All)):    v AutomationTool.Automation.Process(String] CommandLine)
MainFrameActions: Packaging (Android (All)):    v AutomationTool.Program.MainProc(Object Param)
MainFrameActions: Packaging (Android (All)):    v AutomationTool.InternalUtils.RunSingleInstance(MainProc Main, Object Param)
MainFrameActions: Packaging (Android (All)):    v AutomationTool.Program.Main()
MainFrameActions: Packaging (Android (All)): Program.Main: ERROR: ERROR: cmd.exe failed with args /c "C:/NVPACK/apache-ant-1.9.4/bin/ant.bat" -quiet debug
MainFrameActions: Packaging (Android (All)): ProcessManager.KillAll: Trying to kill 0 spawned processes.
MainFrameActions: Packaging (Android (All)): Program.Main: AutomationTool exiting with ExitCode=1
MainFrameActions: Packaging (Android (All)): Domain_ProcessExit
MainFrameActions: Packaging (Android (All)): ProcessManager.KillAll: Trying to kill 0 spawned processes.
MainFrameActions: Packaging (Android (All)): copying UAT log files...
MainFrameActions: Packaging (Android (All)): RunUAT.bat ERROR: AutomationTool was unable to run successfully.
MainFrameActions: Packaging (Android (All)): BUILD FAILED

It’s crashing on – LogActorComponent: UnregisterComponent: (/Engine/Transient.CharMoveComp) Not registered. Aborting.
you may be hitting a known bug:

Hi Sojka,

You can safely ignore those javac warnings and go back to the 1.8.2 version of Apache Ant. As your builds are failing and not crashing, I am reasonably sure it is unrelated to the threads Devfo Studios has linked.

Without seeing the entirety of your failed build output logs, however, I can’t see if something higher up is causing the build failure. Here is another recent thread with a user having the same failure. His issue was improper placement of the sing.keystore file. Have a look at that and see if your build succeeds. If it does not, please post the entire log (or send to me via PM if you feel uncomfortable posting the entirety here). Since you will have made changes to your TADP setup, you will want to restart your machine before you attempt another build.

Hope that helps!

Thanks for your advice, but unfortunally it wasn’t the problem… I am building it in the development mode. However even though I tried to make the keystore and build it in the shipping mode and it’s still the same… I sent you PM, because I didn’t know how to make the keystore, but I have already found some infos on the internet. It fails again and again, so I sent you the whole output log via PM :slight_smile:

So I have finally solved the problem. For those, who has the same problem I have some tips, what to do (some of these tips probably solved my problem):

  1. DO NOT build it for ‘All’ Android, but only ‘ETC1’
  2. Check your SDK version (update if it’s possible)
  3. Check the version of ANT and jdk (update if it’s possible)
  4. In Project Settings fill the paths & options (in ‘Android SDK’)
  5. Check in Environment Variables if the paths are to the newest versions

I confirm the first step helps in solving this problem.
Thank you sir