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:
EditorUserBuildSettings.buildAppBundle = true;
EditorUserBuildSettings.androidBuildSystem = AndroidBuildSystem.Gradle;
EditorUserBuildSettings.exportAsGoogleAndroidProject = false;
PlayerSettings.SetScriptingBackend(BuildTargetGroup.Android, ScriptingImplementation.IL2CPP);
PlayerSettings.Android.targetArchitectures = AndroidArchitecture.ARMv7 | AndroidArchitecture.ARM64;
PlayerSettings.Android.useCustomKeystore = true;
PlayerSettings.Android.keystoreName = "/path/to/keystore";
PlayerSettings.Android.keystorePass = "keystore_password";
PlayerSettings.Android.keyaliasName = "signing key";
PlayerSettings.Android.keyaliasPass = "signing_key_password";
I noticed the build output contains these lines:
Android PostProcess task "IL2CPP" took 147349.294 ms
Android PostProcess task "Build native Unity binary" took 12947.3173 ms
Android PostProcess task "Zipping symbols" took 1.8931 ms
Android PostProcess task "Performance Reporting Symbol Upload" took 162126.2656 ms
Android PostProcess task "Preparing streaming assets" took 5.7367 ms
Android PostProcess task "Creating APK expansion package (OBB)" took 0.78 ms
Android PostProcess task "Exporting project" took 982.0455 ms
While doing the build from within the Unity editor, I get these lines:
Android PostProcess task "IL2CPP" took 155622.0093 ms
Android PostProcess task "Build native Unity binary" took 14134.3299 ms
Android PostProcess task "Zipping symbols" took 0.4512 ms
Android PostProcess task "Performance Reporting Symbol Upload" took 789.1855 ms
Android PostProcess task "Preparing streaming assets" took 18.1923 ms
Android PostProcess task "Creating APK expansion package (OBB)" took 0.8546 ms
Android PostProcess task "Exporting project" took 1056.4111 ms
Android PostProcess task "Building Gradle project" took 46101.1997 ms
Android PostProcess task "Moving output package(s)" took 95.5783 ms
Android PostProcess task "Processing Mapping File" took 5.8697 ms
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?