Download

APK build suddenly failing, seemingly since going to Production and back to Dev build

I have done some searches on this topic and it seems that I may be out of luck since it could be any random issue/change in my project… but here goes nothing:

I had no issues packaging and launching the default Dev build to my android device…
I changed it to the Production build to see if it would speed up rebuilds…(maybe a bad assumption on my part, assumed it may leave out some debugging files)
Production build was also working fine and launching on my device…

After a day or so of modifying my BP and C++ code… suddenly I keep getting the same error when trying to launch on my device. I have tried changing many of the build params etc… restarting my editor, VS, computer…

Play in editor works flawlessly still, but the package fails every time I try to install it on my phone now, whether in Dev or Production build…(though I havent tried debug).

This is a snip of the relevant error:


LogPlayLevel: UnrealBuildTool:       [dex] Converting compiled files and external libraries into C:\Projects\Unreal\DontCrash\Intermediate\Android\APK\bin\classes.dex...
LogPlayLevel: UnrealBuildTool:        [dx]
LogPlayLevel: UnrealBuildTool:        [dx] UNEXPECTED TOP-LEVEL EXCEPTION:
LogPlayLevel: UnrealBuildTool:        [dx] java.util.zip.ZipException: error in opening zip file
LogPlayLevel: UnrealBuildTool:        [dx]    at java.util.zip.ZipFile.open(Native Method)
LogPlayLevel: UnrealBuildTool:        [dx]    at java.util.zip.ZipFile.<init>(ZipFile.java:219)
LogPlayLevel: UnrealBuildTool:        [dx]    at java.util.zip.ZipFile.<init>(ZipFile.java:149)
LogPlayLevel: UnrealBuildTool:        [dx]    at java.util.zip.ZipFile.<init>(ZipFile.java:163)
LogPlayLevel: UnrealBuildTool:        [dx]    at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:244)
LogPlayLevel: UnrealBuildTool:        [dx]    at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:166)
LogPlayLevel: UnrealBuildTool:        [dx]    at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:144)
LogPlayLevel: UnrealBuildTool:        [dx]    at com.android.dx.command.dexer.Main.processOne(Main.java:677)
LogPlayLevel: UnrealBuildTool:        [dx]    at com.android.dx.command.dexer.Main.processAllFiles(Main.java:574)
LogPlayLevel: UnrealBuildTool:        [dx]    at com.android.dx.command.dexer.Main.runMonoDex(Main.java:311)
LogPlayLevel: UnrealBuildTool:        [dx]    at com.android.dx.command.dexer.Main.run(Main.java:277)
LogPlayLevel: UnrealBuildTool:        [dx]    at com.android.dx.command.dexer.Main.main(Main.java:245)
LogPlayLevel: UnrealBuildTool:        [dx]    at com.android.dx.command.Main.main(Main.java:106)
LogPlayLevel: UnrealBuildTool:        [dx] 1 error; aborting
LogPlayLevel: UnrealBuildTool:
LogPlayLevel: UnrealBuildTool: BUILD FAILED
LogPlayLevel: UnrealBuildTool: C:\NVPACK\android-sdk-windows	ools\ant\build.xml:888: The following error occurred while executing this line:
LogPlayLevel: UnrealBuildTool: C:\NVPACK\android-sdk-windows	ools\ant\build.xml:890: The following error occurred while executing this line:
LogPlayLevel: UnrealBuildTool: C:\NVPACK\android-sdk-windows	ools\ant\build.xml:902: The following error occurred while executing this line:
LogPlayLevel: UnrealBuildTool: C:\NVPACK\android-sdk-windows	ools\ant\build.xml:283: null returned: 1
LogPlayLevel: UnrealBuildTool:
LogPlayLevel: UnrealBuildTool: Total time: 41 seconds
LogPlayLevel: UnrealBuildTool: ERROR: System.IO.FileNotFoundException: Could not find file 'C:\Projects\Unreal\DontCrash\Intermediate/Android/APK/bin/DontCrash-debug.apk'.
LogPlayLevel: UnrealBuildTool: File name: 'C:\Projects\Unreal\DontCrash\Intermediate/Android/APK/bin/DontCrash-debug.apk'
LogPlayLevel: UnrealBuildTool:    at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
LogPlayLevel: UnrealBuildTool:    at System.IO.File.InternalCopy(String sourceFileName, String destFileName, Boolean overwrite, Boolean checkHost)
LogPlayLevel: 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, Boolean bDisallowExternalFile
sDir)
LogPlayLevel: UnrealBuildTool:    at UnrealBuildTool.UEDeployAndroid.PrepTargetForDeployment(UEBuildDeployTarget InTarget)
LogPlayLevel: UnrealBuildTool:    at UnrealBuildTool.AndroidPlatform.Deploy(UEBuildDeployTarget Target)
LogPlayLevel: UnrealBuildTool:    at UnrealBuildTool.UnrealBuildTool.RunUBT(String] Arguments, FileReference ProjectFile)
LogPlayLevel: UnrealBuildTool: Total build time: 271.62 seconds (Local executor: 84.04 seconds)
LogPlayLevel: CommandUtils.Run: Run: Took 272.2687413s to run UnrealBuildTool.exe, ExitCode=5
LogPlayLevel: Program.Main: ERROR: AutomationTool terminated with exception: AutomationTool.CommandUtils+CommandFailedException: Command failed (Result:5): C:\Program Files\Epic Games\UE_4.15\Engine\Binaries\DotNET\UnrealBuildTool.exe DontCrash Android Development -Project=C:\Projects\Unreal\DontCrash\DontCrash.uproject  C:\Projects\Unreal\DontCrash\DontCras
h.uproject  -remoteini="C:\Projects\Unreal\DontCrash" -noxge -NoHotReload -ignorejunk. See logfile for details: 'UnrealBuildTool-2017.05.26-06.01.04.txt'
LogPlayLevel:    at AutomationTool.CommandUtils.RunAndLog(String App, String CommandLine, String Logfile, Int32 MaxSuccessCode, String Input, ERunOptions Options, Dictionary`2 EnvVars, SpewFilterCallbackType SpewFilterCallback)
LogPlayLevel:    at AutomationTool.CommandUtils.RunAndLog(CommandEnvironment Env, String App, String CommandLine, String LogName, Int32 MaxSuccessCode, String Input, ERunOptions Options, Dictionary`2 EnvVars, SpewFilterCallbackType SpewFilterCallback)
LogPlayLevel:    at AutomationTool.CommandUtils.RunUBT(CommandEnvironment Env, String UBTExecutable, String CommandLine, String LogName, Dictionary`2 EnvVars)
LogPlayLevel:    at AutomationTool.CommandUtils.RunUBT(CommandEnvironment Env, String UBTExecutable, FileReference Project, String Target, String Platform, String Config, String AdditionalArgs, String LogName, Dictionary`2 EnvVars)
LogPlayLevel:    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)
LogPlayLevel:    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)
LogPlayLevel:    at Project.Build(BuildCommand Command, ProjectParams Params, Int32 WorkingCL, ProjectBuildTargets TargetMask)
LogPlayLevel:    at BuildCookRun.DoBuildCookRun(ProjectParams Params)
LogPlayLevel:    at BuildCookRun.ExecuteBuild()
LogPlayLevel:    at AutomationTool.BuildCommand.Execute()
LogPlayLevel:    at AutomationTool.Automation.Execute(List`1 CommandsToExecute, CaselessDictionary`1 Commands)
LogPlayLevel:    at AutomationTool.Automation.Process(String] Arguments)
LogPlayLevel:    at AutomationTool.Program.MainProc(Object Param)
LogPlayLevel:    at AutomationTool.InternalUtils.RunSingleInstance(Func`2 Main, Object Param)
LogPlayLevel:    at AutomationTool.Program.Main()
LogPlayLevel: Program.Main: AutomationTool exiting with ExitCode=5 (5)
LogPlayLevel: Completed Launch On Stage: Build Task, Time: 274.312710
LogPlayLevel: BUILD FAILED
PackagingResults:Error: Error Launch failed! Unknown Error

Interestingly, it is looking for Debug apk, regardless of me selecting between production and development, (and I have never once selected Debug build anyway)… Though maybe this is just the typical Android notation of a build either being Debug or Release…

I have tried selecting the full rebuild option in packaging settings, cleaning/rebuilding in Visual studio… everything works fine for PIE… no errors pop up.

Is there any file I can delete from my project maybe to force the tools to start over?

After making a new template project, I inserted all of my C++ code and the project packaged fine. So then I moved/deleted and recreated my failing project with the same name and pasted my content folder in. Fixed some janky references in the blueprints that it didnt really like and my project is working fine again.

I’m about 90% sure my project started failing to compile because of options I selected in the project settings. There is a nice “Default” button that is unfortunately greyed out… it would have been useful.

I’m glad you were able to solve it. For future reference the APK output from Ant is either -debug.apk or -release.apk before we copy it to the target location. I think your issue might have been cleared up if you deleted the Intermediate/Android directory in your project and repackaged, too.