I have a VR game developed in Unity for Oculus and I want to create an Android App Bundle to upload it to the play store as a mobile game too. When I go into build I select this options: Building options

And here is the problem, after finishing compiling it throws some errors:


OverflowException: Value was either too large or too small for an Int32.
System.Number.ThrowOverflowOrFormatException (System.Boolean overflow, System.String overflowResourceKey) (at <a40b0ad4a868437393ad434631fb6ff1>:0)
System.Number.ParseInt32 (System.ReadOnlySpan`1[T] value, System.Globalization.NumberStyles styles, System.Globalization.NumberFormatInfo info) (at <a40b0ad4a868437393ad434631fb6ff1>:0)
System.Int32.Parse (System.String s, System.IFormatProvider provider) (at <a40b0ad4a868437393ad434631fb6ff1>:0)
System.Convert.ToInt32 (System.String value) (at <a40b0ad4a868437393ad434631fb6ff1>:0)
UnityEditor.Android.BundleToolWrapper.CheckApksSize (UnityEditor.Android.AndroidJavaTools javaTools, System.String stagingArea, System.Action`1[T] progress) (at <c8df8c387877487dae452aacc833e6ce>:0)
UnityEditor.Android.PostProcessor.Tasks.CheckApksSize.Execute (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <c8df8c387877487dae452aacc833e6ce>:0)
UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <c8df8c387877487dae452aacc833e6ce>:0)
UnityEditor.Android.PostProcessAndroidPlayer.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args, AndroidPlayerBuildProgram.Data.AndroidPlayerBuildProgramOutput buildProgramOutput) (at <c8df8c387877487dae452aacc833e6ce>:0)
UnityEditor.Android.AndroidBuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args, UnityEditor.BuildProperties& outProperties) (at <c8df8c387877487dae452aacc833e6ce>:0)
UnityEditor.PostprocessBuildPlayer.Postprocess (UnityEditor.BuildTargetGroup targetGroup, UnityEditor.BuildTarget target, System.Int32 subtarget, System.String installPath, System.String companyName, System.String productName, System.Int32 width, System.Int32 height, UnityEditor.BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry, UnityEditor.Build.Reporting.BuildReport report) (at <5092d70d16a64dd9a555dd50f38aead0>:0)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&)
Build completed with a result of 'Failed' in 294 seconds (293528 ms)
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&
UnityEditor.BuildPlayerWindow+BuildMethodException: 2 errors
  at UnityEditor.BuildPlayerWindow+DefaultBuildMethods.BuildPlayer (UnityEditor.BuildPlayerOptions options) [0x002da] in <5092d70d16a64dd9a555dd50f38aead0>:0 
  at UnityEditor.BuildPlayerWindow.CallBuildMethods (System.Boolean askForBuildLocation, UnityEditor.BuildOptions defaultBuildOptions) [0x00080] in <5092d70d16a64dd9a555dd50f38aead0>:0 
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)

The strange thing for me is that the .apk compiles just fine. I need the aab because the game is now around 2GB and will likely be more in the future. Where does this error come from? is it a code problem or something related to configurations?


1 Answer 1


As DMGregory said, the problem is that the aab file is larger than a 32-bit singed integer. The problem in this case is that I had a scene which weighted over 2GB. The other problem I had is that the first scene was to big, it has to be under 15MB, a loading scene, the other can be bigger, but not more than 2GB and the aab has a maximum size but I do not know what that limit is.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .