Skip to content

Commit

Permalink
Fix androidTargetSdkVersion (game-ci#425)
Browse files Browse the repository at this point in the history
* Fix androidTargetSdkVersion

Fix for newer versions of Android API levels that do not get correctly parsed.

* Update dist/default-build-script/Assets/Editor/UnityBuilderAction/Input/AndroidSettings.cs
  • Loading branch information
davidmfinol authored Aug 11, 2022
1 parent db2d8b6 commit 2684be2
Showing 1 changed file with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,19 @@ public static void Apply(Dictionary<string, string> options)
if (options.TryGetValue("androidKeyaliasPass", out string keyaliasPass) && !string.IsNullOrEmpty(keyaliasPass))
PlayerSettings.Android.keyaliasPass = keyaliasPass;
if (options.TryGetValue("androidTargetSdkVersion", out string androidTargetSdkVersion) && !string.IsNullOrEmpty(androidTargetSdkVersion))
PlayerSettings.Android.targetSdkVersion = (AndroidSdkVersions) Enum.Parse(typeof(AndroidSdkVersions), androidTargetSdkVersion);
{
var targetSdkVersion = AndroidSdkVersions.AndroidApiLevelAuto;
try
{
targetSdkVersion =
(AndroidSdkVersions) Enum.Parse(typeof(AndroidSdkVersions), androidTargetSdkVersion);
}
catch
{
UnityEngine.Debug.Log("Failed to parse androidTargetSdkVersion! Fallback to AndroidApiLevelAuto");
}
PlayerSettings.Android.targetSdkVersion = targetSdkVersion;
}
}
}
}

0 comments on commit 2684be2

Please sign in to comment.