diff --git a/src/Android/Android.csproj b/src/Android/Android.csproj index 7fddeb977..13b7e6731 100644 --- a/src/Android/Android.csproj +++ b/src/Android/Android.csproj @@ -155,6 +155,7 @@ + diff --git a/src/Android/update-android.ps1 b/src/Android/update-android.ps1 new file mode 100644 index 000000000..4d4996655 --- /dev/null +++ b/src/Android/update-android.ps1 @@ -0,0 +1,28 @@ +$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 '(?\d+)- (?.+), 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 28*' } +Install-AndroidSDK -sdks $sdks +dir "${env:ProgramFiles(x86)}\Android\android-sdk\platforms" \ No newline at end of file