diff --git a/scripts/android-licenses/android-sdk-license b/scripts/android-licenses/android-sdk-license new file mode 100644 index 00000000..ee55294f --- /dev/null +++ b/scripts/android-licenses/android-sdk-license @@ -0,0 +1,2 @@ + +24333f8a63b6825ea9c5514f83c2829b004d1fee diff --git a/scripts/setup-android-ci.ps1 b/scripts/setup-android-ci.ps1 index 01bab44b..957fe852 100644 --- a/scripts/setup-android-ci.ps1 +++ b/scripts/setup-android-ci.ps1 @@ -26,10 +26,13 @@ Move-Item -LiteralPath $source -Destination $destination $env:ANDROID_HOME = $sdkRoot $env:ANDROID_SDK_ROOT = $sdkRoot $manager = Join-Path $destination 'bin\sdkmanager.bat' -$answers = ('y' + [Environment]::NewLine) * 100 -$answers | & $manager "--sdk_root=$sdkRoot" --licenses | Out-Null -if ($LASTEXITCODE -ne 0) { throw 'Android SDK license setup failed' } -$answers | & $manager "--sdk_root=$sdkRoot" 'platform-tools' 'platforms;android-37.0' 'build-tools;37.0.0' +# Transfer the already accepted workstation license, as documented by Google: +# https://developer.android.com/studio/intro/update#download-with-gradle +# The self-hosted runner does not reliably forward stdin to sdkmanager prompts. +$licenses = Join-Path $sdkRoot 'licenses' +New-Item -ItemType Directory -Path $licenses -Force | Out-Null +Copy-Item -LiteralPath (Join-Path $PSScriptRoot 'android-licenses\android-sdk-license') -Destination $licenses +& $manager "--sdk_root=$sdkRoot" 'platform-tools' 'platforms;android-37.0' 'build-tools;37.0.0' if ($LASTEXITCODE -ne 0) { throw 'Android SDK installation failed' } foreach ($required in @('platforms\android-37.0\android.jar', 'build-tools\37.0.0\aapt2.exe', 'licenses\android-sdk-license')) { if (-not (Test-Path -LiteralPath (Join-Path $sdkRoot $required))) {