# Cooking from Command Line Android

**URL:** <https://forums.unrealengine.com/t/cooking-from-command-line-android/305906>\
**Category:** Mobile\
**Tags:** Cooking, unreal-engine, Android, question\
**Created:** [February 3, 2015, 9:41pm UTC](https://forums.unrealengine.com/t/cooking-from-command-line-android/305906 "2015-02-03T21:41:42Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![spaceharry](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@spaceharry](https://forums.unrealengine.com/u/spaceharry)\
**Post date:** [February 3, 2015, 9:41pm UTC](https://forums.unrealengine.com/t/cooking-from-command-line-android/305906/1 "2015-02-03T21:41:42Z")

</div>

Hi

I was looking into to minimize package size for mobile.

I saw on

> **[Content Cooking](https://docs.unrealengine.com/5.0/en-US/cooking-content-in-unreal-engine/)**
>
> Generating platform-specific content for assets used in the game.

that there is an option -compressed when cooking from commandline. Is this compressed option automatically used from the editor when building the package for shipping?

Unfortunately I am also unsure about how to cook for Android from command line, when I only want to use ETC1 for example. No matter what I try the build get stuck at GC and no folder is “Sandboxes” folder is created like it is mentioned for the output directory.

---

<div class="post-metadata">

**Author:** ![joshbadams](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@joshbadams](https://forums.unrealengine.com/u/joshbadams)\
**Post date:** [February 3, 2015, 9:53pm UTC](https://forums.unrealengine.com/t/cooking-from-command-line-android/305906/2 "2015-02-03T21:53:17Z")

</div>

Sounds like you are doing cook on the fly, not just precooking (although I didn’t see that on that page). The GC line is normal for using cook on the fly, because the cooker starts up and then waits for a client (after collecting some garbage, aka GC).

You would want to do:

UE4Editor -run=cook -targetplatform=Android\_ETC1 -map=Map1+Map2 -compressed

And the output is now in Saved/Cooked, not Sandboxes (we had to shorten some paths recently).

Josh

---

<div class="post-metadata">

**Author:** ![spaceharry](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@spaceharry](https://forums.unrealengine.com/u/spaceharry)\
**Post date:** [February 3, 2015, 10:35pm UTC](https://forums.unrealengine.com/t/cooking-from-command-line-android/305906/3 "2015-02-03T22:35:40Z")

</div>

Thanks, but still not working. Just to mention, the project packages fine from within the editor:

Here’s what I do:

- In a dos window I go to the directory of my Engine in Engine/Binaries/Win64
- UE4Editor -project=“Directory of my game including uproject file” -run=cook -targetplatform=Android\_ETC1 -map=AllMaps -Compressed

Then a window pops up and goes trough a process very fast in 10s and closes automatically. So I dont see whats the error there. I tried to make a batch file with a PAUSE command to prevent automatic closing of the window, but as it opens a new dos window I cannot prevent it from closing I think.

No Etc Cooked Folder is created anywhere.

Edit: If the -compress option doesn’t do anything different than the In-Editor shipping conifugration, then I won’t bother with this problem anymore.

---

<div class="post-metadata">

**Author:** ![joshbadams](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@joshbadams](https://forums.unrealengine.com/u/joshbadams)\
**Post date:** [February 3, 2015, 11:03pm UTC](https://forums.unrealengine.com/t/cooking-from-command-line-android/305906/4 "2015-02-03T23:03:25Z")

</div>

Ah, sorry, use UE4Editor-cmd, which is the command prompt printing version. That will help figure it out.

---

<div class="post-metadata">

**Author:** ![spaceharry](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@spaceharry](https://forums.unrealengine.com/u/spaceharry)\
**Post date:** [February 4, 2015, 12:04am UTC](https://forums.unrealengine.com/t/cooking-from-command-line-android/305906/5 "2015-02-04T00:04:42Z")

</div>

It markes the build as a success with 9.36s, but I can’t find any apk or obb anywhere.

Also I have to use -maps instead of -maps, otherwise it wont find the packages for the levels.

The only warning which I think is relevant is:

LogDirectoryWatcher:Warning: Failed to begin reading directory changes for C:/Users/username/AppData/Local/UnrealEngine/4.5/Binaries/Win64. Error: 0

…

[2015.02.03-23.49.47:665][0]LogInit:Display: Success - 0 error(s), 26 warning(s)

(The other warnings are deleted fonts)

I have both my project and the unreal engine installed on a second hard drive. Don’t know if that is relevant here.

On my main hard drive under appdate/local a Android\_ETC1 Folder is created after the build which only contains a Engine folder with a AssetRegistry.bin.

Again I am running the command from within my engine folder on the 2nd hard drive under Binaries\Win64, which I assume is correct.

I also ran cmd as administrator.

---

<div class="post-metadata">

**Author:** ![joshbadams](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@joshbadams](https://forums.unrealengine.com/u/joshbadams)\
**Post date:** [February 4, 2015, 12:40am UTC](https://forums.unrealengine.com/t/cooking-from-command-line-android/305906/6 "2015-02-04T00:40:21Z")

</div>

You are only cooking, not packaging. You need to use UAT to do a package.

Engine\Build\BatchFIles\RunUAT BuildCookRun -project=MyProject/MyProject.uproject -skipcook -stage -package -pak -archive -archivedir=

Note that you already cooked, so I specified to skip cook, but if you want to cook and package at once, you would use -cook -AdditionalCookerOptions="-compressed"

(Note I haven’t tested the AdditionalCookerOptions in awhile, but this should work)

Josh

---

<div class="post-metadata">

**Author:** ![spaceharry](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@spaceharry](https://forums.unrealengine.com/u/spaceharry)\
**Post date:** [February 4, 2015, 12:52am UTC](https://forums.unrealengine.com/t/cooking-from-command-line-android/305906/7 "2015-02-04T00:52:49Z")

</div>

Ok so building is the same as cooking. Hope I got that right 🙂

I was just wondering about this compresse option, because always when uploading on google play it gives me the message that apk and obb could be more compressed.

---

<div class="post-metadata">

**Author:** ![spaceharry](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@spaceharry](https://forums.unrealengine.com/u/spaceharry)\
**Post date:** [February 4, 2015, 3:52am UTC](https://forums.unrealengine.com/t/cooking-from-command-line-android/305906/8 "2015-02-04T03:52:49Z")

</div>

When using both of the packaging commands I get the error below about a missing automation script. This is on 4.51, but I checked on 4.7, which also doesn’t have the script in the specified folder.

ScriptCompiler.LoadPreCompiledScriptAssemblies: ERROR: Scripts folder F:\UE4\Epic Games\4.5\Engine\Binaries\DotNET\AutomationScripts does not exist!  
Program.Main: ERROR: AutomationTool terminated with exception:  
Program.Main: ERROR: Exception in AutomationTool: AutomationScripts.Automation.dll was not found or could not be loaded, can’t run scripts.  
Stacktrace: at AutomationTool.ScriptCompiler.LoadPreCompiledScriptAssemblies(List`1 OutScriptAssemblies) at AutomationTool.ScriptCompiler.FindAndCompileAllScripts(List`1 AdditionalScriptsFolders)  
at AutomationTool.Automation.Process(String[] CommandLine)  
at AutomationTool.Program.MainProc(Object Param)  
at AutomationTool.InternalUtils.RunSingleInstance(MainProc Main, Object Param)  
at AutomationTool.Program.Main()  
Program.Main: ERROR: AutomationScripts.Automation.dll was not found or could not be loaded, can’t run scripts.  
ProcessManager.KillAll: Trying to kill 0 spawned processes.

It might be nice to use packaging from command line, because then it would be maybe possible to delete some engine content which I am unable to delete at runtime. (To minimize apk/obb size)

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_c5eb5368](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_c5eb5368](https://forums.unrealengine.com/u/anonymous_user_c5eb5368)\
**Post date:** [November 27, 2015, 4:12am UTC](https://forums.unrealengine.com/t/cooking-from-command-line-android/305906/9 "2015-11-27T04:12:08Z")

</div>

> **[A new, community-hosted Unreal Engine Wiki](https://forums.unrealengine.com/t/a-new-community-hosted-unreal-engine-wiki/141494)**
>
> After over a year in maintenance mode, the official Unreal Engine Wiki is now permanently offline. These resources now live on a new community-run Unreal Engine Community Wiki — https://unrealcommunity.wiki/! You will be able to find content from...

dont forget the platform=Android

---

<div class="post-metadata">

**Author:** ![ivanesses](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ivanesses](https://forums.unrealengine.com/u/ivanesses)\
**Post date:** [October 17, 2017, 5:30pm UTC](https://forums.unrealengine.com/t/cooking-from-command-line-android/305906/10 "2017-10-17T17:30:38Z")

</div>

UnrealBuildTool: ERROR: GetBuildPlatform: No BuildPlatform found for Android

---

<div class="post-metadata">

**Author:** ![Yvasquez](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Yvasquez](https://forums.unrealengine.com/u/Yvasquez)\
**Post date:** [July 5, 2019, 11:13pm UTC](https://forums.unrealengine.com/t/cooking-from-command-line-android/305906/11 "2019-07-05T23:13:52Z")

</div>

Hi, I know it’s a bit late to write here, but I’m trying to do this myself. Achievement compile a. apk but when I open it in the device it asks for obb file, I do not know if I should specify that it must be created or created all packaged inside the apk.  
the command you use is the following …

```
RunUAT BuildCookRun -project="D:\my.uproject" -noP4 -platform=Android -clientconfig=Shipping -cook -allmaps -build -stage -pak -archive -archivedirectory="D:\Users\hh\Documents\Builds"

```

I do not know what I did wrong, thank you very much for the help.
