Improve building for Android

This commit is contained in:
Wojtek Figat
2023-02-14 15:27:13 +01:00
parent 752fa64cc3
commit 47afc7817f
2 changed files with 12 additions and 7 deletions

View File

@@ -33,7 +33,9 @@ namespace Flax.Build.Platforms
return;
// Find Android SDK folder path
var sdkPath = Environment.GetEnvironmentVariable("ANDROID_SDK");
var sdkPath = Environment.GetEnvironmentVariable("ANDROID_HOME");
if (string.IsNullOrEmpty(sdkPath))
sdkPath = Environment.GetEnvironmentVariable("ANDROID_SDK");
if (string.IsNullOrEmpty(sdkPath))
{
// Look for adb in Android folders of some common locations
@@ -53,6 +55,8 @@ namespace Flax.Build.Platforms
foreach (string searchDir in searchDirs)
{
string androidDir = Path.Combine(searchDir, "Android");
if (!Directory.Exists(androidDir))
androidDir = Path.Combine(searchDir, "sdk");
if (Directory.Exists(androidDir))
{
string[] subDirs = Directory.GetDirectories(androidDir, "*sdk*", SearchOption.TopDirectoryOnly);
@@ -72,7 +76,7 @@ namespace Flax.Build.Platforms
}
else if (!Directory.Exists(sdkPath))
{
Log.Warning(string.Format("Specified Android SDK folder in ANDROID_SDK env variable doesn't exist ({0})", sdkPath));
Log.Warning(string.Format("Specified Android SDK folder in ANDROID_HOME env variable doesn't exist ({0})", sdkPath));
}
if (string.IsNullOrEmpty(sdkPath))
{