While building AAB, file not found error for APK?

I thought the point of building AAB was that APK was not built.

I’m using an editor script to build an Android ARCore Google playstore project. But now, with Unity 2021.3.4 I’m getting this “file not found” error, trying to validate the size of an APK. I am intentionally building an AAB because that is what the google playstore wants. Same code worked fine with Unity 2021.3.1.

Anybody else getting this error?

FileNotFoundException: Could not find file 'D:\editor-build\Android\ARCore\1\MyApp.apk'.
System.IO.FileInfo.get_Length () (at <d4cde64232cf45659d86aafa597faa77>:0)
UnityEditor.Android.PostProcessor.Tasks.CheckApksSize.Execute (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <c3a2c42a45424b88b29dfadf7f497cbb>:0)
UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <c3a2c42a45424b88b29dfadf7f497cbb>:0)
UnityEditor.Android.PostProcessAndroidPlayer.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args, AndroidPlayerBuildProgram.Data.AndroidPlayerBuildProgramOutput buildProgramOutput) (at <c3a2c42a45424b88b29dfadf7f497cbb>:0)
UnityEditor.Android.AndroidBuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args, UnityEditor.BuildProperties& outProperties) (at <c3a2c42a45424b88b29dfadf7f497cbb>: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 <36f62d8e760b48f7af5d32916f997ce1>:0)
UnityEditor.BuildPipeline:BuildPlayer(BuildPlayerOptions)
ICEreality.Builders.AndroidBuilder:BuildARCore(String, String, Int32, Boolean, Boolean) (at Assets/Editor/Builders/AndroidBuilder.cs:147)
BuildHelper:AndroidGUI() (at Assets/Editor/BuildHelper.cs:419)
BuildHelper:OnGUI() (at Assets/Editor/BuildHelper.cs:84)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&)

Okay, looks like I’ve made an error.

I was still passing in a filename with “apk” in the BuildPlayerOptions object in the “locationPathName” field.

Previously, the builder didn’t care that I did that. But 2021.3.4 is making me more honest.

Changing it to “aab” fixes my error. So, nevermind!

1 Like

Hi can I now how did you fix this problem? Where is BuildPlayerOptions?

I still got error when building aab any solution?