Skip to content

Commit 66fea14

Browse files
jonathanpeppersjonpryor
authored andcommitted
Log what is happening during path selection (#46)
Downstream, in the proprietary parts of Xamarin.Android, there are some strange errors occurring, such as: Task "InstallPackageAssemblies" InstallPackageAssemblies Task ... AndroidSdkPath: /Users/builder/android-toolchain/sdk AndroidNdkPath: /Users/builder/android-toolchain/ndk JavaSdkPath: /usr Xamarin.Android.Common.Debugging.targets(479,2): error ADB0000: Error finding Android/Java SDKs […/monodroid/tests/runtime/Xamarin.Android.RuntimeTests.csproj] Xamarin.Android.Common.Debugging.targets(479,2): error ADB0000: System.InvalidOperationException: Could not determine Android SDK location. Please provide `androidSdkPath`. […/monodroid/tests/runtime/Xamarin.Android.RuntimeTests.csproj] Xamarin.Android.Common.Debugging.targets(479,2): error ADB0000: at Xamarin.Android.Tools.AndroidSdkInfo..ctor (System.Action`2[T1,T2] logger, System.String androidSdkPath, System.String androidNdkPath, System.String javaSdkPath) [0x0004b] in <5fd439f4454d4cc18bc8c35d2b4c840c>:0 […/monodroid-pr/monodroid/tests/runtime/Xamarin.Android.RuntimeTests.csproj] Xamarin.Android.Common.Debugging.targets(479,2): error ADB0000: at Xamarin.AndroidTools.AndroidSdk.Refresh (System.String androidSdkPath, System.String androidNdkPath, System.String javaSdkPath) [0x00000] in <9cb77bd2eef54f10a4aa7622ee40470d>:0 […/monodroid-pr/monodroid/tests/runtime/Xamarin.Android.RuntimeTests.csproj] We are having a lot of trouble even figuring out what is going on, since the EXACT SAME paths worked earlier in the same build. Earlier in the log `ResolveSdks` worked just fine! I'm hoping this logging information will help us troubleshoot this issue and other scenarios in the future.
1 parent e0e9de9 commit 66fea14

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/Xamarin.Android.Tools.AndroidSdk/Sdks/AndroidSdkBase.cs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,23 +122,29 @@ public string NdkHostPlatform {
122122
/// </summary>
123123
public bool ValidateAndroidSdkLocation (string loc)
124124
{
125-
return !string.IsNullOrEmpty (loc) && ProcessUtils.FindExecutablesInDirectory (Path.Combine (loc, "platform-tools"), Adb).Any ();
125+
bool result = !string.IsNullOrEmpty (loc) && ProcessUtils.FindExecutablesInDirectory (Path.Combine (loc, "platform-tools"), Adb).Any ();
126+
Logger (TraceLevel.Verbose, $"{nameof (ValidateAndroidSdkLocation)}: `{loc}`, result={result}");
127+
return result;
126128
}
127129

128130
/// <summary>
129131
/// Checks that a value is the location of a Java SDK.
130132
/// </summary>
131133
public virtual bool ValidateJavaSdkLocation (string loc)
132134
{
133-
return !string.IsNullOrEmpty (loc) && ProcessUtils.FindExecutablesInDirectory (Path.Combine (loc, "bin"), JarSigner).Any ();
135+
bool result = !string.IsNullOrEmpty (loc) && ProcessUtils.FindExecutablesInDirectory (Path.Combine (loc, "bin"), JarSigner).Any ();
136+
Logger (TraceLevel.Verbose, $"{nameof (ValidateJavaSdkLocation)}: `{loc}`, result={result}");
137+
return result;
134138
}
135139

136140
/// <summary>
137141
/// Checks that a value is the location of an Android SDK.
138142
/// </summary>
139143
public bool ValidateAndroidNdkLocation (string loc)
140144
{
141-
return !string.IsNullOrEmpty (loc) && ProcessUtils.FindExecutablesInDirectory (loc, NdkStack).Any ();
145+
bool result = !string.IsNullOrEmpty (loc) && ProcessUtils.FindExecutablesInDirectory (loc, NdkStack).Any ();
146+
Logger (TraceLevel.Verbose, $"{nameof (ValidateAndroidNdkLocation)}: `{loc}`, result={result}");
147+
return result;
142148
}
143149

144150
protected static string NullIfEmpty (string s)

0 commit comments

Comments
 (0)