How to add more Android SDKs to build agents?
I need to arrange for the build agent to have additional Android SDKs installed. I have to do this locally on my own machines as well because these SDK versions are not installed by the default Xamarin/VS installation.
From this build: https://ci.appveyor.com/project/AArnott/pclcrypto/build/1.0.57
I see this error:
C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(413,2): error : Could not find android.jar for API Level 10. This means the Android SDK platform for API Level 10 is not installed. Either install it in the Android SDK Manager (Tools > Open Android SDK Manager...), or change your Xamarin.Android project to target an API version that is installed. (C:\Users\appveyor\AppData\Local\Android\android-sdk\platforms\android-10\android.jar missing.)
How can I arrange to have this preinstalled?
Comments are currently closed for this discussion. You can start a new one.
Keyboard shortcuts
Generic
| ? | Show this help |
|---|---|
| ESC | Blurs the current field |
Comment Form
| r | Focus the comment reply box |
|---|---|
| ^ + ↩ | Submit the comment |
You can use Command ⌘ instead of Control ^ on Mac

1 Posted by andrewarnott on 01 Oct, 2015 04:22 AM
I figured it out. I added this powershell script to my Environment Install Script:
#$AndroidToolPath = "${env:ProgramFiles(x86)}\Android\android-sdk\tools\android"
$AndroidToolPath = "$env:localappdata\Android\android-sdk\tools\android"
Function Get-AndroidSDKs() {
$output = & $AndroidToolPath list sdk --all
$sdks = $output |% {
if ($_ -match '(?<index>\d+)- (?<sdk>.+), revision (?<revision>[\d\.]+)') {
$sdk = New-Object PSObject
Add-Member -InputObject $sdk -MemberType NoteProperty -Name Index -Value $Matches.index
Add-Member -InputObject $sdk -MemberType NoteProperty -Name Name -Value $Matches.sdk
Add-Member -InputObject $sdk -MemberType NoteProperty -Name Revision -Value $Matches.revision
$sdk
}
}
$sdks
}
Function Install-AndroidSDK() {
[CmdletBinding()]
Param(
[Parameter(Mandatory=$true, Position=0)]
[PSObject[]]$sdks
)
$sdkIndexes = $sdks |% { $_.Index }
$sdkIndexArgument = [string]::Join(',', $sdkIndexes)
Echo 'y' | & $AndroidToolPath update sdk -u -a -t $sdkIndexArgument
}
$sdks = Get-AndroidSDKs |? { $_.name -like 'sdk platform*API 10*' -or $_.name -like 'google apis*api 10' }
Install-AndroidSDK -sdks $sdks
Support Staff 2 Posted by Feodor Fitsner on 01 Oct, 2015 09:50 PM
Wow, nice! Thanks for sharing that with community!
- Feodor
3 Posted by Jason on 03 Nov, 2015 11:21 PM
huh?
o_O
andrewarnott closed this discussion on 22 Jan, 2016 02:33 PM.