Huge Universal APK size when building through unity cli 2022.3.24

When building an aab via GUI the universal apk size is about 500 MB, but when trying to build via CLI it’s 1.8 GB! After closer inspection it seems to build assets differently in GUI vs CLI, here are the contents of bin/Data folder for both builds, they’re completely different for the same project with the same settings, and in the CLI-built apk there is also a file that is over 1 GB in size! What could cause such behavior? I have multiple projects with builds done in TeamCity and everything worked fine, this is the first time I’m seeing something like this


The problem was that I didn’t pass the compression parameter in BuildOptions, and Unity defaults to no compression, after setting buildOptions |= BuildOptions.CompressWithLz4, it works as intended.

2 Likes