There are quite a few steps to run apps on the App Center while configuring Test Runs in Xamarin.
First, install the following:
- Android SDK https://developer.android.com/studio
- Visual Studio 2019 with the Xamarin addon in the Visual Studio Installer:
- Java SDK http://java.sun.com/javase/downloads/index.jsp
Once everything was installed, I restarted my command prompt, opened my Xamarin Android app project in VS and did a Debug build to demo the app. Once I did this, that triggered the build for the APK file.
Then I do the commands the over in the web browser Microsoft App Center (https://appcenter.ms), but I add a bug fix parameter to the end of the Running Tests command (–uitest with path).
appcenter login appcenter test run uitest --app "DevOps-Training-1/Android-xamarin" --devices "DevOps-Training-1/both" --app-path C:\vs\MobileDevOps\MobileDevOps\bin\Debug\com.companyname.MobileDevOps.apk --test-series "master" --locale "en_US" --build-dir C:\vs\MobileDevOps\UIAndroidTest\bin\Debug --uitest-tools-dir C:\Users\EricSchrader\.nuget\packages\xamarin.uitest\3.0.3\tools
You will get an ANDOID_HOME error,
(No path) - Not set. [ Source: ANDROID_HOME ]
Then, set the ANDOID_HOME Windows Android SDK location (make sure you replace the user desktop account with your current user path)
set JAVA_HOME=C:\Users\EricSchrader\AppData\Local\Android\Sdk set PATH=%PATH%;%ANDROID_HOME%\tools;%ANDROID_HOME%\platform-tools
That should get you to the next error, JAVA_HOME.
If you see this error:
Java Development Kit (JDK) not found. Please make sure that it is installed and if it's still not located, please set the JAVA_HOME environment variable to point to the directory.
Then, set the JAVA_HOME path (and make sure your JDK version matches)
- Overview: https://docs.oracle.com/cd/E19182-01/821-0917/inst_jdk_javahome_t/index.html
- Actual commands I used (NOTE YOUR VERSION and make sure that path exists, otherwise replace with your jdk- version number)
set JAVA_HOME=C:\Program Files\Java\jdk-14.0.2 set PATH=%PATH%;%JAVA_HOME%\bin
Once all is done, the app test will be submitted and complete without issues:
Check out Donovan Browns post as well for an alternative way of doing this in VS. I was using CMDer, https://www.donovanbrown.com/post/Migrating-from-Xamarin-Test-Cloud-to-App-Center-Test