ERROR: Game target not found. When building for android

I’ve been trying to fix this all day and I’ve had no joy.

Recently I accidently added a c++ class to my blueprint project and ever since I’ve been unable to package the project for android.

This is the error the logs give me.

BuildCookRun.SetupParams: Setting up ProjectParams for 
InternalUtils.SafeFileExists: SafeFileExists C:\Users\No\AppData\Local\Temp\UAT\C+Program+Files+Epic+Games+UE_4.20\Rules\UATRules-2074089503.dll=False
<>c.<PrintExceptionInfo>b__4_1: ==============================================================================
<>c.<PrintExceptionInfo>b__4_0: ERROR: Game target not found. Game target is required with -cook or -cookonthefly
<>c.<PrintExceptionInfo>b__4_0:        (see for full exception trace)
<>c.<PrintExceptionInfo>b__4_1: 
<>c.<PrintExceptionInfo>b__4_1: AutomationException: Game target not found. Game target is required with -cook or -cookonthefly
<>c.<PrintExceptionInfo>b__4_1:    at AutomationTool.ProjectParams.AutodetectSettings(Boolean bReset) in D:\Build\++UE4\Sync\Saved\CsTools\Engine\Source\Programs\AutomationTool\AutomationUtils\ProjectParams.cs:line 2087
<>c.<PrintExceptionInfo>b__4_1:    at AutomationTool.ProjectParams..ctor(FileReference RawProjectPath, BuildCommand Command, String Device, String MapToRun, String AdditionalServerMapParams, ParamList`1 Port, String RunCommandline, String StageCommandline, String BundleName, String StageDirectoryParam, String UE4Exe, String SignPak, List`1 ClientConfigsToBuild, List`1 ServerConfigsToBuild, ParamList`1 MapsToCook, ParamList`1 MapIniSectionsToCook, ParamList`1 DirectoriesToCook, String InternationalizationPreset, ParamList`1 CulturesToCook, ParamList`1 ClientCookedTargets, ParamList`1 EditorTargets, ParamList`1 ServerCookedTargets, List`1 ClientTargetPlatforms, Dictionary`2 ClientDependentPlatformMap, List`1 ServerTargetPlatforms, Dictionary`2 ServerDependentPlatformMap, Nullable`1 Build, Nullable`1 SkipBuildClient, Nullable`1 SkipBuildEditor, Nullable`1 Cook, Nullable`1 Run, Nullable`1 SkipServer, Nullable`1 Clean, Nullable`1 Compressed, String AdditionalPakOptions, Nullable`1 UseDebugParamForEditorExe, Nullable`1 IterativeCooking, String IterateSharedCookedBuild, Nullable`1 IterateSharedBuildUsePrecompiledExe, Nullable`1 CookAll, Nullable`1 CookPartialGC, Nullable`1 CookInEditor, String CookOutputDir, Nullable`1 CookMapsOnly, Nullable`1 CookOnTheFly, Nullable`1 CookOnTheFlyStreaming, Nullable`1 UnversionedCookedContent, Nullable`1 EncryptIniFiles, Nullable`1 EncryptPakIndex, Nullable`1 EncryptEverything, Nullable`1 SkipCookingEditorContent, Nullable`1 NumCookersToSpawn, String AdditionalCookerOptions, String BasedOnReleaseVersion, String CreateReleaseVersion, String CreateReleaseVersionBasePath, String BasedOnReleaseVersionBasePath, Nullable`1 GeneratePatch, Nullable`1 AddPatchLevel, Nullable`1 StageBaseReleasePaks, Nullable`1 GenerateRemaster, String DiscVersion, String DLCName, String DiffCookedContentPath, Nullable`1 DLCIncludeEngineContent, Nullable`1 DLCPakPluginFile, Nullable`1 DLCActLikePatch, Nullable`1 CrashReporter, Nullable`1 DedicatedServer, Nullable`1 Client, Nullable`1 Deploy, String DeployFolder, String GetFile, Nullable`1 FileServer, Nullable`1 Foreign, Nullable`1 ForeignCode, Nullable`1 LogWindow, Nullable`1 NoCleanStage, Nullable`1 NoClient, Nullable`1 NoDebugInfo, Nullable`1 SeparateDebugInfo, Nullable`1 MapFile, Nullable`1 NoXGE, Nullable`1 Package, Nullable`1 Pak, Nullable`1 Prereqs, String AppLocalDirectory, Nullable`1 NoBootstrapExe, Nullable`1 SignedPak, Nullable`1 NullRHI, Nullable`1 FakeClient, Nullable`1 EditorTest, Nullable`1 RunAutomationTests, String RunAutomationTest, Nullable`1 CrashIndex, Nullable`1 SkipCook, Nullable`1 SkipCookOnTheFly, Nullable`1 SkipPak, Nullable`1 PrePak, Nullable`1 SkipStage, Nullable`1 Stage, Nullable`1 Manifests, Nullable`1 CreateChunkInstall, Nullable`1 Unattended, Nullable`1 NumClients, Nullable`1 Archive, String ArchiveDirectoryParam, Nullable`1 ArchiveMetaData, Nullable`1 CreateAppBundle, ParamList`1 ProgramTargets, Nullable`1 Distribution, Nullable`1 Prebuilt, Nullable`1 RunTimeoutSeconds, String SpecifiedArchitecture, String UbtArgs, Nullable`1 IterativeDeploy, Nullable`1 FastCook, Nullable`1 IgnoreCookErrors, Nullable`1 RunAssetNativization, Nullable`1 CodeSign, Nullable`1 TreatNonShippingBinariesAsDebugFiles, Nullable`1 UseExtraFlavor, String Provision, String Certificate, String Team, Boolean AutomaticSigning, ParamList`1 InMapsToRebuildLightMaps, ParamList`1 InMapsToRebuildHLOD, ParamList`1 TitleID) in D:\Build\++UE4\Sync\Saved\CsTools\Engine\Source\Programs\AutomationTool\AutomationUtils\ProjectParams.cs:line 1019
<>c.<PrintExceptionInfo>b__4_1:    at BuildCookRun.SetupParams() in D:\Build\++UE4\Sync\Saved\CsTools\Engine\Source\Programs\AutomationTool\Scripts\BuildCookRun.Automation.cs:line 52
<>c.<PrintExceptionInfo>b__4_1:    at BuildCookRun.ExecuteBuild() in D:\Build\++UE4\Sync\Saved\CsTools\Engine\Source\Programs\AutomationTool\Scripts\BuildCookRun.Automation.cs:line 39
<>c.<PrintExceptionInfo>b__4_1:    at AutomationTool.BuildCommand.Execute() in D:\Build\++UE4\Sync\Saved\CsTools\Engine\Source\Programs\AutomationTool\AutomationUtils\BuildCommand.cs:line 112
<>c.<PrintExceptionInfo>b__4_1:    at AutomationTool.Automation.Execute(List`1 CommandsToExecute, Dictionary`2 Commands) in D:\Build\++UE4\Sync\Saved\CsTools\Engine\Source\Programs\AutomationTool\AutomationUtils\Automation.cs:line 562
<>c.<PrintExceptionInfo>b__4_1:    at AutomationTool.Automation.Process(String[] Arguments, StartupTraceListener StartupListener) in D:\Build\++UE4\Sync\Saved\CsTools\Engine\Source\Programs\AutomationTool\AutomationUtils\Automation.cs:line 532
<>c.<PrintExceptionInfo>b__4_1:    at AutomationTool.Program.MainProc(String[] Arguments, StartupTraceListener StartupListener) in D:\Build\++UE4\Sync\Saved\CsTools\Engine\Source\Programs\AutomationTool\Program.cs:line 174
<>c.<PrintExceptionInfo>b__4_1:    at AutomationTool.Program.<>c__DisplayClass1_0.<Main>b__0() in D:\Build\++UE4\Sync\Saved\CsTools\Engine\Source\Programs\AutomationTool\Program.cs:line 100
<>c.<PrintExceptionInfo>b__4_1:    at AutomationTool.InternalUtils.RunSingleInstance(Func`1 Main) in D:\Build\++UE4\Sync\Saved\CsTools\Engine\Source\Programs\AutomationTool\AutomationUtils\Utils.cs:line 725
<>c.<PrintExceptionInfo>b__4_1:    at AutomationTool.Program.Main() in D:\Build\++UE4\Sync\Saved\CsTools\Engine\Source\Programs\AutomationTool\Program.cs:line 100
<>c.<PrintExceptionInfo>b__4_1: ==============================================================================
Program.Main: AutomationTool exiting with ExitCode=1 (Error_Unknown)

Does anyone have any idea why this might be happening?

Try removing the C++ class from your project then convert it back to blueprint only:

I ran into something like this. It happened when I used one project as a basis for another and renamed things. In my case, I accidentally omitted the dot in “Source/[ProjectName].Target.cs” between the name of my project and “Target”. Very hard to know what was wrong from the error, but afterwards it compiled like normal. I suspect its something similar - something in one of the build files.

It was tricky to see in my case, since there are two files: “Source/[ProjectName].Target.cs” and “Source/[ProjectName]Editor.Target.cs”. Since the editor one was fine, I didn’t run into this problem until packaging. In my case this was all on Windows, so not necessarily related to the platform I think.

You are my new favorite person!

Now I’m having another problem with packaging.

It’s saying it can’t make an APK without the compiled .so

UEDeployAndroid.UpdateGameActivity: 
UEDeployAndroid.UpdateGameActivity: ==== Writing new GameActivity.java file to F:\Unreal Projects\Header\Intermediate/Android/APK\src\com\epicgames\ue4\GameActivity.java ====
<>c.<PrintExceptionInfo>b__4_1: ==============================================================================
<>c.<PrintExceptionInfo>b__4_0: ERROR: Can't make an APK without the compiled .so [F:\Unreal Projects\Header\Binaries\Android\Header-armv7-es2.so]
<>c.<PrintExceptionInfo>b__4_0:        (see for full exception trace)
<>c.<PrintExceptionInfo>b__4_1:

Hey try closing the project and deleting the following 3 subfolders from within your projects folder:

Binaries
Intermediate
Saved

then try building again. If the error is still there then usually there is another reason further up the logs…

I got it working now thanks!

You were right I just restarted and redid what it said in the link and it works now so I must have missed something first time round.

Thanks again!

Thank you so much!