Update the Android SDK for a Visual Studio Build Tools installation
We recently set the Target Framework Version for our mobile app to SDK Version 29. On two of our three build agents, we had no issues because they were regular Visual Studio instances running on developer machines. But one build agent only had the Visual Studio Build Tools installed without any GUI.
After some digging in the Visual Studio and Android SDK folder, I couldn't find the AndroidSdkManager.exe that's provided from the regular Visual Studio Installation.
After searching the Android Developer site, I found an article that explained how to update or install SDKs by the command line:
On the build agent, the path was
C:\Program Files (x86)\Android\android-sdk\tools\bin
Start a PowerShell Session (Shift+Right-click) and type
.\sdkmanager.bat --list
You will see a list of all installed android tools.
The last output of the previous command will be available updates.
Make sure to install those by running
.\sdkmanager.bat --update
But be careful, you have to accept the SDK License Agreement.
Back to our missing build-tools and platform version we have to issue another command
.\sdkmanager.bat "build-tools;29.0.3"
.\sdkmanager.bat "platforms;android-29"
Now you can trigger a build from your CI pipeline and see if everything is working.