bEnableUniversalAPK

bEnableUniversalAPK

#Overview

name: bEnableUniversalAPK

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 bEnableUniversalAPK is to control the creation of a Universal APK for Android devices. This setting is related to the Android build and deployment process in Unreal Engine 5.

This setting variable is primarily used by the Android platform-specific modules in Unreal Engine, specifically the Android deployment and build systems. Based on the references, it’s used in:

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

These files are part of the Unreal Engine’s build and automation tools for Android platform support.

The value of this variable is set in the Android Runtime Settings, specifically in the “/Script/AndroidRuntimeSettings.AndroidRuntimeSettings” section of the project’s configuration files. It’s read using the ConfigHierarchy system, which suggests it can be set in various configuration files following Unreal’s config hierarchy.

This variable interacts with other Android-specific build settings, particularly those related to APK and AAB (Android App Bundle) creation. It may affect how the build system packages and deploys the game for Android devices.

Developers should be aware that enabling this option might increase the size of the APK, as a Universal APK includes support for multiple device configurations in a single package. This could impact download sizes and storage requirements on end-user devices.

Best practices when using this variable include:

  1. Consider the target audience and device spread before enabling.
  2. Balance the convenience of a universal APK against potential size increases.
  3. Test thoroughly on various Android devices when enabled to ensure compatibility.
  4. Consider using it in conjunction with Android App Bundles for more efficient distribution through the Google Play Store.

There isn’t a specific associated variable mentioned in the provided information. However, it’s closely related to other Android build settings and may interact with variables controlling APK splitting, ABI selection, and texture compression for Android builds.

#Setting Variables

#References In INI files

Location: <Workspace>/Engine/Config/BaseEngine.ini:3082, 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:328

Scope (from outer to inner):

file
class        class UAndroidRuntimeSettings : public UObject

Source code excerpt:

	// 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
	UPROPERTY(GlobalConfig, EditAnywhere, Category = "App Bundles", Meta = (DisplayName = "Enable ABI split", EditCondition = "bEnableBundle"))
	bool bBundleABISplit;

	// Separate resources by language 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:947

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

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

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


					bool bEnableUniversalAPK = false;
					Ini.GetBool("/Script/AndroidRuntimeSettings.AndroidRuntimeSettings", "bEnableUniversalAPK", out bEnableUniversalAPK);

					// update gradle.properties to set STORE_VERSION properly, and OUTPUT_BUNDLEFILENAME
					string GradlePropertiesFilename = Path.Combine(UnrealBuildGradlePath, "gradle.properties");
					string GradlePropertiesContent = File.ReadAllText(GradlePropertiesFilename);
					GradlePropertiesContent += String.Format("\nSTORE_VERSION={0}\nOUTPUT_BUNDLEFILENAME={1}\n", BaseStoreVersion,
						Path.GetFileNameWithoutExtension(OutputPath).Replace("UnrealGame", ProjectName) + ".aab");

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


			bool bEnableUniversalAPK = false;
			Ini.GetBool("/Script/AndroidRuntimeSettings.AndroidRuntimeSettings", "bEnableUniversalAPK", out bEnableUniversalAPK);

			GradleProperties.AppendLine("org.gradle.daemon=false");
			GradleProperties.AppendLine("org.gradle.jvmargs=-XX:MaxHeapSize=4096m -Xmx9216m");
			GradleProperties.AppendLine("android.injected.testOnly=false");
			GradleProperties.AppendLine("android.useAndroidX=true");
			GradleProperties.AppendLine("android.enableJetifier=true");