MinSDKVersion
MinSDKVersion
#Overview
name: MinSDKVersion
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 2
C++ source files. 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 MinSDKVersion is to specify the minimum Android SDK version that the Unreal Engine project will support. This setting is crucial for determining the compatibility of the game with various Android devices and OS versions.
This setting variable is primarily used by the Android platform-specific modules of Unreal Engine, specifically:
- The Android automation tool (AndroidPlatform.Automation.cs)
- The Android toolchain (AndroidToolChain.cs)
- The Android deployment system (UEDeployAndroid.cs)
The value of this variable is set in the Android Runtime Settings of the Unreal Engine project. It can be found in the configuration file under “/Script/AndroidRuntimeSettings.AndroidRuntimeSettings”.
MinSDKVersion interacts with another variable called TargetSDKVersion. While MinSDKVersion sets the lower bound of Android SDK compatibility, TargetSDKVersion specifies the intended target SDK version for the project.
Developers must be aware that:
- Setting MinSDKVersion too low may include devices that lack features required by the game.
- Setting it too high might unnecessarily limit the potential user base.
- This setting affects the build process and the resulting APK’s compatibility.
Best practices when using this variable include:
- Regularly reviewing and updating it to balance between supporting older devices and leveraging newer Android features.
- Ensuring it aligns with the project’s requirements and target audience.
- Testing the game on devices with the minimum supported SDK version to ensure compatibility.
Regarding the associated variable TargetSDKVersion:
The purpose of TargetSDKVersion is to specify the Android SDK version that the Unreal Engine project is targeting. This determines which Android features and APIs are available to the game.
TargetSDKVersion is used by the same Unreal Engine subsystems as MinSDKVersion, namely the Android platform-specific modules.
Like MinSDKVersion, the value of TargetSDKVersion is set in the Android Runtime Settings of the Unreal Engine project, under “/Script/AndroidRuntimeSettings.AndroidRuntimeSettings”.
TargetSDKVersion directly interacts with MinSDKVersion. It must be equal to or greater than MinSDKVersion.
Developers should be aware that:
- TargetSDKVersion affects how the app behaves on newer Android versions.
- It doesn’t prevent the app from running on older versions (down to MinSDKVersion).
- Setting it to the latest stable SDK version is generally recommended for access to new features and optimizations.
Best practices for TargetSDKVersion include:
- Keeping it updated to the latest stable SDK version when possible.
- Testing the game on devices with the target SDK version to ensure optimal performance and feature utilization.
- Considering the balance between leveraging new features and maintaining compatibility with a wider range of devices.
#Setting Variables
#References In INI files
Location: <Workspace>/Engine/Config/BaseEngine.ini:3060, section: [/Script/AndroidRuntimeSettings.AndroidRuntimeSettings]
- INI Section:
/Script/AndroidRuntimeSettings.AndroidRuntimeSettings
- Raw value:
26
- Is Array:
False
#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:220
Scope (from outer to inner):
file
class class UAndroidRuntimeSettings : public UObject
Source code excerpt:
// What OS version the app is allowed to be installed on (do not set this lower than 26)
UPROPERTY(GlobalConfig, EditAnywhere, Category = "APK Packaging", Meta = (DisplayName = "Minimum SDK Version (26=8.0.0, 27=8.1.0, 28=9, 29=10, 30=11, 31=12)"))
int32 MinSDKVersion;
// What OS version the app is expected to run on (do not set this lower than 26)
UPROPERTY(GlobalConfig, EditAnywhere, Category = "APK Packaging", Meta = (DisplayName = "Target SDK Version (26=8.0.0, 27=8.1.0, 28=9, 29=10, 30=11, 31=12)"))
int32 TargetSDKVersion;
// Preferred install location for the application
#Loc: <Workspace>/Engine/Source/Runtime/Android/AndroidRuntimeSettings/Classes/AndroidRuntimeSettings.h:314
Scope (from outer to inner):
file
function class ANDROIDRUNTIMESETTINGS_API UAndroidRuntimeSettings : public UObject { public: GENERATED_UCLASS_BODY
Source code excerpt:
bool bValidateTextureFormats;
// When building for MinSDKVersion >= 23 gradle will leave native libs uncompressed in the apk. This flag might be helpful for builds that are not intended to be distributed via Google Play
UPROPERTY(GlobalConfig, EditAnywhere, Category = "APK Packaging", Meta = (DisplayName = "Force Gradle to compress native libs irregardless of MinSDKVersion setting"))
bool bForceCompressNativeLibs;
// Generates Android binary with RELR and APS2 relocation tables when building for MinSDKVersion >= 28 or just APS2 when building for MinSDKVersion >= 23
UPROPERTY(GlobalConfig, EditAnywhere, Category = "APK Packaging", Meta = (DisplayName = "Enable compression of relocation tables (and more). Depends on MinSDKVersion setting"))
bool bEnableAdvancedBinaryCompression;
// Enables generating AAB bundle
UPROPERTY(GlobalConfig, EditAnywhere, Category = "App Bundles", Meta = (DisplayName = "Generate bundle (AAB)"))
bool bEnableBundle;
#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:1306
ConfigHierarchy Ini = ConfigCache.ReadHierarchy(ConfigHierarchyType.Engine, DirectoryReference.FromFile(Params.RawProjectPath), UnrealTargetPlatform.Android);
int MinSDKVersion;
Ini.GetInt32("/Script/AndroidRuntimeSettings.AndroidRuntimeSettings", "MinSDKVersion", out MinSDKVersion);
int TargetSDKVersion = MinSDKVersion;
Ini.GetInt32("/Script/AndroidRuntimeSettings.AndroidRuntimeSettings", "TargetSDKVersion", out TargetSDKVersion);
Logger.LogInformation("{Text}", "Target SDK Version " + TargetSDKVersion);
bool bDisablePerfHarden = false;
if (TargetConfiguration != UnrealTargetConfiguration.Shipping)
{
Location: <Workspace>/Engine/Source/Programs/UnrealBuildTool/Platform/Android/AndroidToolChain.cs:363
int MinSDKVersion = MinSdk;
ConfigHierarchy Ini = ConfigCache.ReadHierarchy(ConfigHierarchyType.Engine, DirectoryReference.FromFile(ProjectFile), UnrealTargetPlatform.Android);
Ini.GetInt32("/Script/AndroidRuntimeSettings.AndroidRuntimeSettings", "MinSDKVersion", out MinSDKVersion);
return MinSDKVersion;
}
protected virtual bool ValidateNDK(string PlatformsFilename, string ApiString)
{
int MinPlatform, MaxPlatform;
Location: <Workspace>/Engine/Source/Programs/UnrealBuildTool/Platform/Android/UEDeployAndroid.cs:3508
{
ConfigHierarchy Ini = GetConfigCacheIni(ConfigHierarchyType.Engine);
Ini.GetInt32("/Script/AndroidRuntimeSettings.AndroidRuntimeSettings", "MinSDKVersion", out MinSDKVersion);
TargetSDKVersion = MinSDKVersion;
Ini.GetInt32("/Script/AndroidRuntimeSettings.AndroidRuntimeSettings", "TargetSDKVersion", out TargetSDKVersion);
// Check for targetSDKOverride from UPL
string TargetOverride = UPL.ProcessPluginNode(NDKArch, "targetSDKOverride", "");
if (!String.IsNullOrEmpty(TargetOverride))