When running on android build failed

[apkbuilder] Current build type is different than previous build: forced apkbuilder run.
LogPlayLevel: [apkbuilder] Creating Thirdperson-debug-unaligned.apk and signing it with a debug key…
LogPlayLevel: BUILD FAILED
LogPlayLevel: C:\android-sdk-windows\tools\ant\build.xml:958: The following error occurred while executing this line:
LogPlayLevel: C:\android-sdk-windows\tools\ant\build.xml:969: The following error occurred while executing this line:
LogPlayLevel: C:\android-sdk-windows\tools\ant\build.xml:312: com.android.sdklib.build.ApkCreationException: java.lang.ArrayIndexOutOfBoundsException: 13
LogPlayLevel: at com.android.sdklib.build.ApkBuilder.getDebugKey(ApkBuilder.java:308)
LogPlayLevel: at com.android.sdklib.build.ApkBuilder.(ApkBuilder.java:392)
LogPlayLevel: at com.android.ant.ApkBuilderTask.execute(ApkBuilderTask.java:334)
LogPlayLevel: at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
LogPlayLevel: at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
LogPlayLevel: at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
LogPlayLevel: at java.lang.reflect.Method.invoke(Method.java:597)
LogPlayLevel: at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
LogPlayLevel: at org.apache.tools.ant.Task.perform(Task.java:348)
LogPlayLevel: at org.apache.tools.ant.taskdefs.Sequential.execute(Sequential.java:68)
LogPlayLevel: at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
LogPlayLevel: at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
LogPlayLevel: at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
LogPlayLevel: at java.lang.reflect.Method.invoke(Method.java:597)
LogPlayLevel: at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
LogPlayLevel: at org.apache.tools.ant.Task.perform(Task.java:348)
LogPlayLevel: at org.apache.tools.ant.taskdefs.MacroInstance.execute(MacroInstance.java:398)
LogPlayLevel: at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
LogPlayLevel: at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
LogPlayLevel: at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
LogPlayLevel: at java.lang.reflect.Method.invoke(Method.java:597)
LogPlayLevel: at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
LogPlayLevel: at org.apache.tools.ant.Task.perform(Task.java:348)
LogPlayLevel: at org.apache.tools.ant.taskdefs.Sequential.execute(Sequential.java:68)
LogPlayLevel: at com.android.ant.IfElseTask.execute(IfElseTask.java:124)
LogPlayLevel: at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
LogPlayLevel: at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
LogPlayLevel: at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
LogPlayLevel: at java.lang.reflect.Method.invoke(Method.java:597)
LogPlayLevel: at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
LogPlayLevel: at org.apache.tools.ant.Task.perform(Task.java:348)
LogPlayLevel: at org.apache.tools.ant.taskdefs.Sequential.execute(Sequential.java:68)
LogPlayLevel: at com.android.ant.IfElseTask.execute(IfElseTask.java:124)
LogPlayLevel: at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
LogPlayLevel: at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
LogPlayLevel: at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
LogPlayLevel: at java.lang.reflect.Method.invoke(Method.java:597)
LogPlayLevel: at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
LogPlayLevel: at org.apache.tools.ant.Task.perform(Task.java:348)
LogPlayLevel: at org.apache.tools.ant.taskdefs.Sequential.execute(Sequential.java:68)
LogPlayLevel: at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
LogPlayLevel: at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
LogPlayLevel: at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
LogPlayLevel: at java.lang.reflect.Method.invoke(Method.java:597)
LogPlayLevel: at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
LogPlayLevel: at org.apache.tools.ant.Task.perform(Task.java:348)
LogPlayLevel: at org.apache.tools.ant.taskdefs.MacroInstance.execute(MacroInstance.java:398)
LogPlayLevel: at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
LogPlayLevel: at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
LogPlayLevel: at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
LogPlayLevel: at java.lang.reflect.Method.invoke(Method.java:597)
LogPlayLevel: at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
LogPlayLevel: at org.apache.tools.ant.Task.perform(Task.java:348)
LogPlayLevel: at org.apache.tools.ant.Target.execute(Target.java:390)
LogPlayLevel: at org.apache.tools.ant.Target.performTasks(Target.java:411)
LogPlayLevel: at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399)
LogPlayLevel: at org.apache.tools.ant.Project.executeTarget(Project.java:1368)
LogPlayLevel: at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
LogPlayLevel: at org.apache.tools.ant.Project.executeTargets(Project.java:1251)
LogPlayLevel: at org.apache.tools.ant.Main.runBuild(Main.java:809)
LogPlayLevel: at org.apache.tools.ant.Main.startAnt(Main.java:217)
LogPlayLevel: at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
LogPlayLevel: at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)
LogPlayLevel: Caused by: java.lang.ArrayIndexOutOfBoundsException: 13
LogPlayLevel: at sun.util.calendar.BaseCalendar.getDayOfYear(BaseCalendar.java:329)
LogPlayLevel: at sun.util.calendar.BaseCalendar.getFixedDate(BaseCalendar.java:364)
LogPlayLevel: at sun.util.calendar.BaseCalendar.getFixedDate(BaseCalendar.java:339)
LogPlayLevel: at sun.util.calendar.AbstractCalendar.getTime(AbstractCalendar.java:157)
LogPlayLevel: at sun.security.util.DerInputBuffer.getTime(DerInputBuffer.java:373)
LogPlayLevel: at sun.security.util.DerInputBuffer.getUTCTime(DerInputBuffer.java:234)
LogPlayLevel: at sun.security.util.DerInputStream.getUTCTime(DerInputStream.java:481)
LogPlayLevel: at sun.security.x509.CertificateValidity.construct(CertificateValidity.java:69)
LogPlayLevel: at sun.security.x509.CertificateValidity.(CertificateValidity.java:111)
LogPlayLevel: at sun.security.x509.X509CertInfo.parse(X509CertInfo.java:676)
LogPlayLevel: at sun.security.x509.X509CertInfo.(X509CertInfo.java:152)
LogPlayLevel: at sun.security.x509.X509CertImpl.parse(X509CertImpl.java:1731)
LogPlayLevel: at sun.security.x509.X509CertImpl.(X509CertImpl.java:177)
LogPlayLevel: at sun.security.provider.X509Factory.engineGenerateCertificate(X509Factory.java:90)
LogPlayLevel: at java.security.cert.CertificateFactory.generateCertificate(CertificateFactory.java:305)
LogPlayLevel: at sun.security.provider.JavaKeyStore.engineLoad(JavaKeyStore.java:705)
LogPlayLevel: at sun.security.provider.JavaKeyStore$JKS.engineLoad(JavaKeyStore.java:38)
LogPlayLevel: at java.security.KeyStore.load(KeyStore.java:1185)
LogPlayLevel: at com.android.sdklib.internal.build.DebugKeyProvider.loadKeyEntry(DebugKeyProvider.java:174)
LogPlayLevel: at com.android.sdklib.internal.build.DebugKeyProvider.(DebugKeyProvider.java:107)
LogPlayLevel: at com.android.sdklib.build.ApkBuilder.getDebugKey(ApkBuilder.java:272)
LogPlayLevel: … 62 more
LogPlayLevel: Total time: 25 seconds
LogPlayLevel: BuildCommand.Execute: ERROR: BUILD FAILED
LogPlayLevel: Program.Main: ERROR: AutomationTool terminated with exception:
LogPlayLevel: Program.Main: ERROR: Exception in UnrealBuildTool: ERROR: cmd.exe failed with args /c “C:\apache-ant-1.8.2/bin/ant.bat” debug
LogPlayLevel: Stacktrace: at UnrealBuildTool.Android.UEDeployAndroid.RunCommandLineProgramAndThrowOnError(String WorkingDirectory, String Command, String Params, String OverrideDesc, Boolean bUseShellExecute)
LogPlayLevel: at UnrealBuildTool.Android.UEDeployAndroid.MakeApk(String ProjectName, String ProjectDirectory, String OutputPath, String EngineDirectory, Boolean bForDistribution, String CookFlavor, Boolean bMakeSeparateApks, Boolean bIncrementalPackage, Boolean bDisallowPackagingDataInApk)
LogPlayLevel: at UnrealBuildTool.Android.UEDeployAndroid.PrepForUATPackageOrDeploy(String ProjectName, String ProjectDirectory, String ExecutablePath, String EngineDirectory, Boolean bForDistribution, String CookFlavor, Boolean bIsDataDeploy)
LogPlayLevel: at AndroidPlatform.Deploy(ProjectParams Params, DeploymentContext SC)
LogPlayLevel: at Project.Deploy(ProjectParams Params)
LogPlayLevel: at BuildCookRun.DoBuildCookRun(ProjectParams Params)
LogPlayLevel: at BuildCommand.Execute()
LogPlayLevel: at AutomationTool.Automation.Execute(List1 CommandsToExecute, CaselessDictionary1 Commands)
LogPlayLevel: at AutomationTool.Automation.Process(String[] CommandLine)
LogPlayLevel: at AutomationTool.Program.MainProc(Object Param)
LogPlayLevel: at AutomationTool.InternalUtils.RunSingleInstance(Action`1 Main, Object Param)
LogPlayLevel: at AutomationTool.Program.Main()
LogPlayLevel: ProcessManager.KillAll: Trying to kill 0 spawned processes.
LogPlayLevel: Program.Main: AutomationTool exiting with ExitCode=Error_Unknown
LogPlayLevel: Domain_ProcessExit
LogPlayLevel: copying UAT log files…
LogPlayLevel: RunUAT.bat ERROR: AutomationTool was unable to run successfully.
LogPlayLevel: Completed Launch On Stage: Deploy Task, Time: 52.104129
LogPlayLevel: BUILD FAILED
PackagingResults:Error: Error Launch failed! Unknown Error

Hey ,

  1. Please ensure you have TADP set up, along with your [Android SDK in project settings][1] and [your environment variables.][2] Restart your computer.

  2. Make sure there is nothing unusual (additional spaces for example about your [Android package name][3] or [TADP setup.][4]

  3. Make sure [keystore is set up correctly][5], if you’re packaging for distribution and receiving this error. [Here is some additional keystore instruction.][6]

  4. [Double check][7] for [proguard errors.][8]

  5. Last resort, delete current build of TADP and upgrade to most recent. Make sure to have SDK 19 and NDK checked when installing.

Looking forward to hearing back from you, thanks!

Android Development Install Problem UE4 4.7.3 - Mobile - Epic Developer Community Forums
[2]: Android Development Basics for Unreal Engine | Unreal Engine 5.1 Documentation
[3]: Android project name causes ant.bat error - Platform & Builds - Epic Developer Community Forums
[4]: UE 4.7.2 can't pack .apk with Ant - Programming & Scripting - Epic Developer Community Forums
[5]: Firma tu app  |  Desarrolladores de Android  |  Android Developers
[6]: Packaging for Android in Shipping mode fails - Feedback & Requests - Epic Developer Community Forums
[7]: Android for distribution fails to load on device - Mobile - Epic Developer Community Forums
[8]: 4.7 Android Shipping crash on launch - Mobile - Epic Developer Community Forums