bEnableBundle

bEnableBundle

#Overview

name: bEnableBundle

The value of this variable can be defined or overridden in .ini config files. 1 .ini config file referencing this setting variable.

It is referenced in 1 C++ source file. Also referenced in 3 C# build files meaning it may affect the build system logic.

#Summary

#Usage in the C# source code and build system

The purpose of bEnableBundle is to control whether Android App Bundle (AAB) packaging is enabled for the Android build of an Unreal Engine project. This setting is specifically related to the Android build and deployment process.

Based on the references in the C# build files, this variable is primarily used in the Android platform-specific modules of Unreal Engine. It’s referenced in the Android deployment and build tools, specifically in:

  1. AndroidPlatform.Automation.cs
  2. UEDeployAndroid.cs

The value of this variable is set in the Android Runtime Settings of the project. It can be found and modified in the project settings under the “/Script/AndroidRuntimeSettings.AndroidRuntimeSettings” section.

There are other related variables that interact with bEnableBundle:

  1. bBundleABISplit
  2. bBundleLanguageSplit
  3. bBundleDensitySplit

These variables control specific aspects of the App Bundle creation process, such as splitting by ABI, language, or screen density.

Developers must be aware that enabling this option will change the output format of the Android build from APK to AAB. This can affect how the app is distributed and installed on devices. AAB is the new Android app publishing format that offers smaller app downloads and more efficient distribution through the Google Play Store.

Best practices when using this variable include:

  1. Enable it when targeting the Google Play Store, as Google now requires new apps to use the AAB format.
  2. Consider the implications on your distribution process, as AAB files cannot be directly installed on devices and require processing by the Play Store.
  3. Test the AAB thoroughly to ensure all app features work correctly across different device configurations.
  4. Be aware of how this setting interacts with other Android-specific build settings in your project.

The associated variables (bBundleABISplit, bBundleLanguageSplit, bBundleDensitySplit) allow for fine-tuning of the App Bundle creation process. These control how the app’s resources are split, which can affect download sizes and app performance on different devices. Developers should consider enabling these options based on their app’s specific requirements and target audience.

#Setting Variables

#References In INI files

Location: <Workspace>/Engine/Config/BaseEngine.ini:3081, section: [/Script/AndroidRuntimeSettings.AndroidRuntimeSettings]

#References in C++ code

#Callsites

This variable is referenced in the following C++ source code:

#Loc: <Workspace>/Engine/Source/Runtime/Android/AndroidRuntimeSettings/Classes/AndroidRuntimeSettings.h:324

Scope (from outer to inner):

file
class        class UAndroidRuntimeSettings : public UObject

Source code excerpt:

	// Enables generating AAB bundle
	UPROPERTY(GlobalConfig, EditAnywhere, Category = "App Bundles", Meta = (DisplayName = "Generate bundle (AAB)"))
	bool bEnableBundle;

	// Enables generating universal APK from bundle
	UPROPERTY(GlobalConfig, EditAnywhere, Category = "App Bundles", Meta = (DisplayName = "Generate universal APK from bundle", EditCondition = "bEnableBundle"))
	bool bEnableUniversalAPK;

	// Separate ABIs into their own APK in bundle

#References in C# build files

This variable is referenced in the following C# build files:

Location: <Workspace>/Engine/Source/Programs/AutomationTool/Android/AndroidPlatform.Automation.cs:940

		ConfigHierarchy Ini = ConfigCache.ReadHierarchy(ConfigHierarchyType.Engine, DirectoryReference.FromFile(SC.RawProjectPath), SC.StageTargetPlatform.PlatformType);
		bool bEnableBundle = false;
		return (Ini.GetBool("/Script/AndroidRuntimeSettings.AndroidRuntimeSettings", "bEnableBundle", out bEnableBundle) && bEnableBundle);
	}

	private bool GetEnableUniversalAPK(DeploymentContext SC)
	{
		ConfigHierarchy Ini = ConfigCache.ReadHierarchy(ConfigHierarchyType.Engine, DirectoryReference.FromFile(SC.RawProjectPath), SC.StageTargetPlatform.PlatformType);
		bool bEnableUniversalAPK = false;

Location: <Workspace>/Engine/Source/Programs/UnrealBuildTool/Platform/Android/UEDeployAndroid.cs:3936


			bool bEnableBundle, bBundleABISplit, bBundleLanguageSplit, bBundleDensitySplit;
			Ini.GetBool("/Script/AndroidRuntimeSettings.AndroidRuntimeSettings", "bEnableBundle", out bEnableBundle);
			Ini.GetBool("/Script/AndroidRuntimeSettings.AndroidRuntimeSettings", "bBundleABISplit", out bBundleABISplit);
			Ini.GetBool("/Script/AndroidRuntimeSettings.AndroidRuntimeSettings", "bBundleLanguageSplit", out bBundleLanguageSplit);
			Ini.GetBool("/Script/AndroidRuntimeSettings.AndroidRuntimeSettings", "bBundleDensitySplit", out bBundleDensitySplit);

			GradleBuildAdditionsContent.AppendLine("android {");

Location: <Workspace>/Engine/Source/Programs/UnrealBuildTool/Platform/Android/UEDeployAndroid.cs:3478

			ConfigHierarchy Ini = GetConfigCacheIni(ConfigHierarchyType.Engine);
			bool bEnableBundle = false;
			Ini.GetBool("/Script/AndroidRuntimeSettings.AndroidRuntimeSettings", "bEnableBundle", out bEnableBundle);
			return bEnableBundle;
		}

		private bool IsLicenseAgreementValid()
		{
			string LicensePath = Environment.ExpandEnvironmentVariables("%ANDROID_HOME%/licenses");