Android Build Size Exceeds 2GB – Firebase Upload Fails Despite APK Analyzer Showing 1.3GB

Description:

We are encountering an issue while uploading our Android build to Firebase. The upload fails because the build size exceeds the 2GB limit.

However, when analyzed using APK Analyzer in Android Studio the size appears to be only 1.3GB. On disk, however, the build shows a size of 2.5GB, which is causing confusion and blocking our deployment.

Build Environment:

We are using Jenkins as our CI/CD tool and the build process involves the following pipeline steps and commands:

1 . Sync latest code from Perforce

2 . Build Editor:

RunUAT.bat BuildEditor -project=“C:\workspace\development\project-engine\project\project.uproject” -platform=“Win64”

3 . Build Game:

RunUAT.bat BuildGame -project=“C:\workspace\development\project-engine\project\project.uproject” -platform=“Android” -configuration=“Development” -notools

4 . Build Cook Run

RunUAT.bat BuildCookRun -project=“C:\workspace\development\project-engine\project\project.uproject” -platform=“Android” -target=“project” -configuration=“Development” -cookflavor=“ASTC” -archivedirectory=“C:\workspace\development\project- engine\LocalBuilds\Android_project\CL-1234-development-project-Development-Android” -notools -nop4 -utf8output -nocompileeditor -skipbuildeditor -unattended -utf8output -build -cook -stage -pak -prereqs -package -archive -iostore -nocompile -nocompileuat -FastCook -iterativecooking

observations:

  • After cleaning the Intermediate, Binaries, Saved, and DerivedDataCache folders from project (not from engine) and triggering a fresh build on the same agent, the resulting build is successful and within the expected size limits.
  • However, after a few build cycles, the problem reoccurs the build size again exceeds 2GB.

Request for Guidance:

  • Why is the build size on disk showing more than 2GB when APK Analyzer shows only 1.3GB?
  • Is there a way to check what’s causing this size difference?
  • How can we avoid this issue from coming back in future CI builds?

Please let me know if additional details are needed.

Thanks,

Abhishek

Hi Abhishek,

I have not seen the issue where APK Analyzer reports an APK size different than the one on disk.

Are you able to do a diff of the unzipped contents of the good and bloated APKs to better narrow down where the issue could be originating from?

Best regards.

Hi,

I’ve done a comparison between the good and bloated APK builds and here are my findings:

Good Build

  • APK Size: 1.33 GB
  • Renamed the .apk to .zip and extracted it.
  • Unzipped Size: 1.59 GB
  • Contents: 542 files in 37 folders

Bloated Build

  • APK Size: 2.51 GB
  • Renamed the .apk to .zip and extracted it.
  • Unzipped Size: 1.58 GB (almost identical to the good build)
  • Contents: 542 files in 37 folder

Comparison Result

  • I compared the unzipped folders of both builds using Beyond Compare.
  • No new or extra files were found in the bloated build.
  • File counts and folder structures look the same.
  • After extraction, both builds are roughly the same size.

So currently, I’m unsure why the bloated APK is showing a larger size on disk (2.51 GB) even though its extracted contents are nearly identical to the good build.

Let me know if there’s anything else I should check.

Best regards,

Abhishek

Thanks for sharing your findings Abhishek.

At first glance it sounds like the APK archive may be getting padded on second run. Does deleting only the APKs and building result in the same bloating? Also, can you share your APK packaging settings?

Best regards.

Hi Stephane,

As suggested, I deleted only the APK file from the localbuild folder and triggered the build again. However, the resulting APK still had the increased size (~2 GB) and failed to upload to Firebase.

So, the issue appears to persist even after clearing the APK.

Regarding the APK packaging configuration. here is the full section from our DefaultEngine.ini under [/Script/AndroidRuntimeSettings.AndroidRuntimeSettings]

[/Script/AndroidRuntimeSettings.AndroidRuntimeSettings] PackageName=com.company.projectname StoreVersion=1 StoreVersionOffsetArm64=0 StoreVersionOffsetX8664=0 ApplicationDisplayName= VersionDisplayName=1.0 MinSDKVersion=26 TargetSDKVersion=31 InstallLocation=InternalOnly bEnableLint=False bPackageDataInsideApk=True bCreateAllPlatformsInstall=False bDisableVerifyOBBOnStartUp=False bForceSmallOBBFiles=False bAllowLargeOBBFiles=True bAllowPatchOBBFile=False bAllowOverflowOBBFiles=False bDontBundleLibrariesInAPK=False bUseExternalFilesDir=True bPublicLogFiles=True Orientation=SensorLandscape MaxAspectRatio=2.100000 bUseDisplayCutout=False bAllowResizing=False bSupportSizeChanges=False bRestoreNotificationsOnReboot=False bFullScreen=True bEnableNewKeyboard=True DepthBufferPreference=Default bValidateTextureFormats=True bForceCompressNativeLibs=False bEnableAdvancedBinaryCompression=True bEnableBundle=False bEnableUniversalAPK=True bBundleABISplit=True bBundleLanguageSplit=True bBundleDensitySplit=True ExtraApplicationSettings=<meta-data android:name="io.sentry.traces.sample-rate" \n android:value="1.0" /> ExtraActivitySettings= +ExtraPermissions=android.permission.RECORD_AUDIO +ExtraPermissions=android.permission.MODIFY_AUDIO_SETTINGS +ExtraPermissions=android.permission.WRITE_EXTERNAL_STORAGE +ExtraPermissions=android.permission.READ_EXTERNAL_STORAGE bAndroidVoiceEnabled=True bRecordPermissionAtStartupEnabled=True bEnableMulticastSupport=False bPackageForMetaQuest=False bRemoveOSIG=False KeyStore= KeyAlias= KeyStorePassword= KeyPassword= bBuildForArm64=True bBuildForX8664=False bBuildForES31=True bSupportsVulkan=True bSupportsVulkanSM5=False DebugVulkanLayerDirectory=(Path="") bAndroidOpenGLSupportsBackbufferSampling=False bDetectVulkanByDefault=True bBuildWithHiddenSymbolVisibility=True bDisableStackProtector=False bDisableLibCppSharedDependencyValidation=False bSaveSymbols=True bStripShaderReflection=True bEnableGooglePlaySupport=True RequestCodeForPlayGamesActivities=80002 PlayGamesClientId= bForceRefreshToken=False GamesAppID= bSupportAdMob=True AdMobAppID= TagForChildDirectedTreatment=TAG_FOR_CHILD_DIRECTED_TREATMENT_UNSPECIFIED TagForUnderAgeOfConsent=TAG_FOR_UNDER_AGE_OF_CONSENT_UNSPECIFIED MaxAdContentRating=MAX_AD_CONTENT_RATING_G AdMobAdUnitID= GooglePlayLicenseKey= GCMClientSenderID= bShowLaunchImage=True bAllowIMU=False bAllowControllers=True bBlockAndroidKeysOnControllers=False bControllersBlockDeviceFeedback=False AndroidAudio=Default AudioSampleRate=44100 AudioCallbackBufferFrameSize=1024 AudioNumBuffersToEnqueue=4 AudioMaxChannels=0 AudioNumSourceWorkers=0 SpatializationPlugin= SourceDataOverridePlugin= ReverbPlugin= OcclusionPlugin= CompressionOverrides=(bOverrideCompressionTimes=False,DurationThreshold=5.000000,MaxNumRandomBranches=0,SoundCueQualityIndex=0) CacheSizeKB=65536 MaxChunkSizeOverrideKB=0 bResampleForDevice=False SoundCueCookQualityIndex=-1 MaxSampleRate=48000.000000 HighSampleRate=32000.000000 MedSampleRate=24000.000000 LowSampleRate=12000.000000 MinSampleRate=8000.000000 CompressionQualityModifier=1.000000 AutoStreamingThreshold=0.000000 AndroidGraphicsDebugger=None MaliGraphicsDebuggerPath=(Path="") bEnableMaliPerfCounters=False bMultiTargetFormat_ETC2=True bMultiTargetFormat_DXT=True bMultiTargetFormat_ASTC=True TextureFormatPriority_ETC2=0.200000 TextureFormatPriority_DXT=0.600000 TextureFormatPriority_ASTC=0.900000 SDKAPILevelOverride= NDKAPILevelOverride= BuildToolsOverride= bStreamLandscapeMeshLODs=False bEnableDomStorage=FalsePlease let me know if anything in this configuration could be affecting the APK size or if you recommend any changes to resolve the issue.

Best regards,

Abhishek

Hi Stephane,

I wanted to follow up on my earlier post regarding the APK size difference issue.

As shared before:

  • Deleting only the APK and rebuilding still results in the larger file size (~2 GB).
  • I’ve included the full [/Script/AndroidRuntimeSettings.AndroidRuntimeSettings] configuration from our DefaultEngine.ini in my last message.
  • The size discrepancy remains even though the unzipped APK contents are almost identical between the good and bloated builds

Could you please let me know if there’s anything in the packaging settings that could make the APK file bigger than it should be, or if there are other steps I can try to find the cause?

Thanks in advance for your guidance!

Best regards,

Abhishek

Hi Abhishek,

Thanks for the details. I was able to reproduce the issue and can confirm that deleting only $Project/Intermediate/Android/arm64 resolves the issue. We will further investigate why the Gradle portion of the Android build introduces the bloat. At first glance, it appears the ZIP file entries get slightly reordered between runs which may be triggering some internal alignment of the OBB entry.

Best regards.

Hi Abhishek,

This has turned out to be a bug in Google’s Gradle’s incremental APK build. We have implemented a workaround at the following CL: https://github.com/EpicGames/UnrealEngine/commit/15793d5a113662be8d2f426ebbbddabd5d6a2ca5\.

Thanks for bringing this issue to our attention.

Best regards.

Hi Stephane,

Thank you for identifying the root cause and providing the workaround. We’ll update our UEDeployAndroid.cs with the fix from the mentioned CL and test it in our environment.

I will keep you posted on the results after applying the changes.

Appreciate your support on this!

Best regards,

Abhishek

No problem Abhishek. Let us know if you run into any issues after integration.

Best regards.