I guess my expectations are a bit high that when I install Visual Studio 2019 to include cross-platform mobile development (Xamarin.Forms) it would properly configure itself. It turns out that when you try and get UI Test Automation working with Xamarin.Forms that is just not the case.
Let’s peel this onion.
Missing ANDROID_HOME environment variable.
For me the environment variable needed to be set to this:
ANDROID_HOME C:Program Files (x86)Androidandroid-sdk
SetUp : System.Exception : Android SDK not found. Please install it and if it is still not located, please set the ANDROID_HOME environment variable to point to the directory.
Missing JAVA_HOME environment variable.
For me the environment variable had to be set to this:
JAVA_HOME C:Program FilesAndroidjdkmicrosoft_dist_openjdk_188.8.131.52bin
Manually specify the APK location.
This is probably more of a weakness in the Xamarin UI Test Framework rather than Xamarin SDK Setup. You just need to explicitly specify where the APK is for your Android app. Kinda lame but workable.
Too many Android Devices.
This is pretty reasonable. The test automation framework needs to know where to run your tests. In my case, I have a physical phone attached via USB and a simulator. The trick is figuring out what the device serial is. Luckily the device serial numbers are output in the error message. What a pleasant surprise! An actual useful error message!
SetUp : System.Exception : Found 2 connected Android devices. Either only have 1 connected or select one using DeviceSerial during configuration. Devices found: <s1>, <s2>