AndroidSdk.Tools icon indicating copy to clipboard operation
AndroidSdk.Tools copied to clipboard

"System.IO.FileNotFoundException: Could not find adb" error message.

Open JamestsaiTW opened this issue 3 years ago • 1 comments

I get this error message when I try to use MAUI.UITesting.

I trace it and why I got this error from: https://github.com/Redth/AndroidSdk.Tools/blob/master/AndroidSdk/AndroidSdkManager.cs

static string[] KnownLikelyPaths =>
			RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ?
new string[] {
	Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86), "Android", "android-sdk"),
	Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles), "Android", "android-sdk"),
} :
new string []
{
	Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), "Library", "Developer", "android-sdk-macosx"),
	Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), "Library", "Developer", "Xamarin", "android-sdk-macosx"),
	Path.Combine("Developer", "Android", "android-sdk-macosx"),
};

(Just test it on Windows) Because my "Android-SDK" don't install at "Environment.SpecialFolder.ProgramFiles", so I got this error.
When I move my "Android-SDK" folder to "Environment.SpecialFolder.ProgramFiles", it works well.

(All platform) So, I suggest it can throw a detail exception message for user, even allow us can pass custom path for "Android-SDK" folder to the library, thanks.

JamestsaiTW avatar Nov 15 '22 14:11 JamestsaiTW

Exact same issue here, trying to use MAUI.UITesting but I have my android SDK installed on a second drive.

igotinfected avatar Jan 07 '23 13:01 igotinfected

This should be fixed in more recent versions.

Redth avatar Oct 17 '24 13:10 Redth