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. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

[SOLVED] Android .aab command line build exporting as directory

Discussion in 'Android' started by austinborden, Dec 3, 2019.

  1. austinborden

    austinborden

    Joined:
    Aug 5, 2016
    Posts:
    24
    I'm attempting to build my android player with a command line build to export an Android .aab file, but it always exports a gradle project so the output is a directory of files and not an .aab file. It appears to be skipping steps that the builder from within Unity takes.

    My build script sets the following properties before doing the build:

    Code (CSharp):
    1. EditorUserBuildSettings.buildAppBundle = true;
    2. EditorUserBuildSettings.androidBuildSystem = AndroidBuildSystem.Gradle;
    3. EditorUserBuildSettings.exportAsGoogleAndroidProject = false;
    4. PlayerSettings.SetScriptingBackend(BuildTargetGroup.Android, ScriptingImplementation.IL2CPP);
    5. PlayerSettings.Android.targetArchitectures = AndroidArchitecture.ARMv7 | AndroidArchitecture.ARM64;
    6. PlayerSettings.Android.useCustomKeystore = true;
    7. PlayerSettings.Android.keystoreName = "/path/to/keystore";
    8. PlayerSettings.Android.keystorePass = "keystore_password";
    9. PlayerSettings.Android.keyaliasName = "signing key";
    10. PlayerSettings.Android.keyaliasPass = "signing_key_password";
    I noticed the build output contains these lines:

    Code (CSharp):
    1. Android PostProcess task "IL2CPP" took 147349.294 ms
    2. Android PostProcess task "Build native Unity binary" took 12947.3173 ms
    3. Android PostProcess task "Zipping symbols" took 1.8931 ms
    4. Android PostProcess task "Performance Reporting Symbol Upload" took 162126.2656 ms
    5. Android PostProcess task "Preparing streaming assets" took 5.7367 ms
    6. Android PostProcess task "Creating APK expansion package (OBB)" took 0.78 ms
    7. Android PostProcess task "Exporting project" took 982.0455 ms
    While doing the build from within the Unity editor, I get these lines:

    Code (CSharp):
    1. Android PostProcess task "IL2CPP" took 155622.0093 ms
    2. Android PostProcess task "Build native Unity binary" took 14134.3299 ms
    3. Android PostProcess task "Zipping symbols" took 0.4512 ms
    4. Android PostProcess task "Performance Reporting Symbol Upload" took 789.1855 ms
    5. Android PostProcess task "Preparing streaming assets" took 18.1923 ms
    6. Android PostProcess task "Creating APK expansion package (OBB)" took 0.8546 ms
    7. Android PostProcess task "Exporting project" took 1056.4111 ms
    8. Android PostProcess task "Building Gradle project" took 46101.1997 ms
    9. Android PostProcess task "Moving output package(s)" took 95.5783 ms
    10. Android PostProcess task "Processing Mapping File" took 5.8697 ms
    11. Android PostProcess task "Checking APKs size" took 17.755 ms
    So you can see the "Building Gradle project" and the last couple steps are skipped during the command line build. Does anyone know if there's an extra setting I have to use to get the command line build to behave identically to the Unity editor build?
     
    Brogan89 likes this.
  2. JuliusM

    JuliusM

    Unity Technologies

    Joined:
    Apr 17, 2013
    Posts:
    824
  3. austinborden

    austinborden

    Joined:
    Aug 5, 2016
    Posts:
    24
    Ah, yes, that was it. Thanks! It might be helpful if the documentation on the buildAppBundle property mentioned this.
     
    n-dzhulabishvili likes this.
  4. zooraharrisocks

    zooraharrisocks

    Joined:
    Feb 27, 2020
    Posts:
    1
    Could you explain how you built an aab with command line
     
    ppartida likes this.
  5. Tomas1856

    Tomas1856

    Unity Technologies

    Joined:
    Sep 21, 2012
    Posts:
    3,682
    yusuf_isik and austinborden like this.