Android NDK hardcoded to use version 12b in UE4.21

I’m trying to build an installed build of a custom version of UE4.21, and it requires Android support. When building the android binaries, UEBuildAndroid.cs seems to override the system environment variables with whatever is set in the configs at /Script/AndroidPlatformEditor.AndroidSDKSettings (Line 560 of UEBuildAndroid.cs):

			string path;
			foreach (KeyValuePair<string, string> kvp in EnvVarNames)
			{
				if (GetPath(configCacheIni, "/Script/AndroidPlatformEditor.AndroidSDKSettings", kvp.Value, out path) && !string.IsNullOrEmpty(path))
				{
					AndroidEnv.Add(kvp.Key, path);
				}
				else
				{
					string envValue = Environment.GetEnvironmentVariable(kvp.Key);
					if (!String.IsNullOrEmpty(envValue))
					{
						AndroidEnv.Add(kvp.Key, envValue);
					}
				}
			}

I’ve found that in the generated Engine.ini in Engine\Programs\UnrealHeaderTool\Intermediate\Config\CoalescedSourceConfigs this is set:

[/Script/AndroidPlatformEditor.AndroidSDKSettings]
SDKAPILevel=latest
NDKAPILevel=android-19
SDKPath=(Path="C:/NVPACK/android-sdk-windows")
NDKPath=(Path="C:/NVPACK/android-ndk-r12b")
ANTPath=(Path="")
JavaPath=(Path="")

I’ve tried changing Engine\Config\BaseEngine.ini → [/Script/AndroidPlatformEditor.AndroidSDKSettings] to match what I would like to use:

SDKAPILevel=matchndk
NDKAPILevel=android-21
SDKPath=(Path="C:/NVPACK/android-sdk-windows")
NDKPath=(Path="C:/NVPACK/android-ndk-r15c")
ANTPath=(Path="C:/NVPACK/apache-ant-1.8.2")
JavaPath=(Path="C:/NVPACK/jdk1.8.0_77")

However, cleaning the intermediate folders, then doing a rebuild results in the Engine.ini being regenerated, but seems to disregard BaseEngine.ini.

I have so far been unable to find where /Script/AndroidPlatformEditor.AndroidSDKSettings is generated at build-time - does anyone know how I can override these settings for a build of the engine?

download and instal sdk and ndk and jdk in this video :

  1. Intermediate, Saved delete Folder

  2. C:\Users[Username]\AppData\Local\Unreal Engine\Engine\Config\UserEngine.ini Fild And AndroidSDKSettings Path delete

  3. ReStart .uProject

Another…

Engine Source ConfigCacheIni.cpp

ADD in MatchExpansions Func

FConfigExpansion(TEXT("%GAMEFULLDIR%"), FPaths::ConvertRelativePathToFull(FPaths::ProjectDir()))

ADD in CollapseValue Func

ExpandPathValueInline(FPaths::ConvertRelativePathToFull(FPaths::ProjectDir()), TEXT("%GAMEFULLDIR%"));

ADD DefaultEngine.ini

[/Script/AndroidPlatformEditor.AndroidSDKSettings]
SDKPath=(Path="%GAMEFULLDIR%../PlatformSDK/Android/Sdk")
NDKPath=(Path="%GAMEFULLDIR%../PlatformSDK/Android/Sdk/ndk/21.4.7075529")
JavaPath=(Path="%GAMEFULLDIR%../PlatformSDK/Android/jre")

AndroidSDK Build is need Absolute Path. So ADD GAMEFULLDIR .

Intermediate, Saved delete Folder

Rebuild