Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Unity checks for APK size after build AAB

Discussion in 'Android' started by welerson_unity, Jan 3, 2020.

  1. welerson_unity

    welerson_unity

    Joined:
    Jan 3, 2020
    Posts:
    6
    I am running the following code (in file) to build an AAB file. (main code line: EditorUserBuildSettings.buildAppBundle = true;)

    Unity builds correctly the AAB file, however after that, in PostProcess, Unity log says: "Checking APKs size", what causes an error "FileNotFoundException: Could not find file '*.apk'. ", (obviously because APK was not built) and the build stops.

    Why Unity is looking for APK size, and how to skip that step?

    Configuration:
    Unity 2019.2.0
     

    Attached Files:

  2. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    14,446
    You can build an aab directly from Unity, but I'm guessing you require a command line build. You select Build App Bundle (Google Play) checkbox in the Build Setting dialog. In the file you posted, it directly references an apk file name

    buildPlayerOptions.locationPathName = string.Format("{0}.apk",
     
  3. welerson_unity

    welerson_unity

    Joined:
    Jan 3, 2020
    Posts:
    6
    Yes, sure; I got the code and did not realize that.

    It works now. Thank you!
     
  4. ylen_sami

    ylen_sami

    Joined:
    Aug 19, 2019
    Posts:
    6
    This issue still occurs on 2019.4.4f1 when doing command line build. Could you specify what you need to do to fix command line build? As in old response you speak of UI element that you won't access when doing command line build. Our builder does not change default buildPlayerOptions.locationPathName.
     
  5. carldevelopsforcoffee

    carldevelopsforcoffee

    Joined:
    Sep 20, 2017
    Posts:
    17
    Sharing my issue:
    Our previous setup was on Unity2018, where we used `BuildPipeline.BuildPlayer(scenes, apkName, BuildTarget.Android, buildOptions);`

    After updating to Unity2019, this caused the "Checking APK's size....FileNotFoundException: Could not find file '*.apk'. " error. To fix this, I had to check apkName for ".apk" and simply replaced it with ".aab"