From 09bdd5e76628566f0814de1b3b42d6a0907a3706 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D1=83=D1=85=D0=B8=D0=BD=20=D0=98=D0=B3=D0=BE=D1=80?= =?UTF-8?q?=D1=8C?= Date: Mon, 28 Oct 2019 22:11:30 +0300 Subject: [PATCH] Fixed android sdk path detection in versions older than 2019.x --- .../Assets/GooglePlayGames/Editor/GPGSUtil.cs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/source/PluginDev/Assets/GooglePlayGames/Editor/GPGSUtil.cs b/source/PluginDev/Assets/GooglePlayGames/Editor/GPGSUtil.cs index 9c89748b7..9002bc28b 100644 --- a/source/PluginDev/Assets/GooglePlayGames/Editor/GPGSUtil.cs +++ b/source/PluginDev/Assets/GooglePlayGames/Editor/GPGSUtil.cs @@ -445,12 +445,13 @@ public static void Alert(string title, string message) public static string GetAndroidSdkPath() { string sdkPath = EditorPrefs.GetString("AndroidSdkRoot"); +#if UNITY_2019 // Unity 2019.x added installation of the Android SDK in the AndroidPlayer directory // so fallback to searching for it there. - if (String.IsNullOrEmpty(sdkPath) || EditorPrefs.GetBool("SdkUseEmbedded")) + if (string.IsNullOrEmpty(sdkPath) || EditorPrefs.GetBool("SdkUseEmbedded")) { string androidPlayerDir = BuildPipeline.GetPlaybackEngineDirectory(BuildTarget.Android, BuildOptions.None); - if (!String.IsNullOrEmpty(androidPlayerDir)) + if (!string.IsNullOrEmpty(androidPlayerDir)) { string androidPlayerSdkDir = Path.Combine(androidPlayerDir, "SDK"); if (Directory.Exists(androidPlayerSdkDir)) @@ -459,6 +460,12 @@ public static string GetAndroidSdkPath() } } } +#endif + if (sdkPath != null && (sdkPath.EndsWith("/") || sdkPath.EndsWith("\\"))) + { + sdkPath = sdkPath.Substring(0, sdkPath.Length - 1); + } + return sdkPath; }