mirror of
https://github.com/actions/runner-images.git
synced 2025-12-19 08:22:12 +00:00
[Ubuntu] Hardcode android cmd-tools on 18.04 (#7005)
This commit is contained in:
@@ -43,26 +43,33 @@ echo "ANDROID_HOME=${ANDROID_SDK_ROOT}" | tee -a /etc/environment
|
|||||||
# Create android sdk directory
|
# Create android sdk directory
|
||||||
mkdir -p ${ANDROID_SDK_ROOT}
|
mkdir -p ${ANDROID_SDK_ROOT}
|
||||||
|
|
||||||
# Download the latest command line tools so that we can accept all of the licenses.
|
cmdlineTools="android-cmdline-tools.zip"
|
||||||
# See https://developer.android.com/studio/#command-tools
|
|
||||||
cmdlineToolsVersion=$(get_toolset_value '.android."cmdline-tools"')
|
|
||||||
if [[ $cmdlineToolsVersion == "latest" ]]; then
|
|
||||||
repositoryXmlUrl="https://dl.google.com/android/repository/repository2-1.xml"
|
|
||||||
download_with_retries $repositoryXmlUrl "/tmp" "repository2-1.xml"
|
|
||||||
cmdlineToolsVersion=$(
|
|
||||||
yq -p=xml \
|
|
||||||
'.sdk-repository.remotePackage[] | select(."+@path" == "cmdline-tools;latest").archives.archive[].complete.url | select(contains("commandlinetools-linux"))' \
|
|
||||||
/tmp/repository2-1.xml
|
|
||||||
)
|
|
||||||
|
|
||||||
if [[ -z $cmdlineToolsVersion ]]; then
|
if isUbuntu18; then
|
||||||
echo "Failed to parse latest command-line tools version"
|
# Newer command-line-tools require Java 11 which is not default on ubuntu-18.04
|
||||||
exit 1
|
download_with_retries "https://dl.google.com/android/repository/commandlinetools-linux-9123335_latest.zip" "." $cmdlineTools
|
||||||
fi
|
else
|
||||||
|
# Download the latest command line tools so that we can accept all of the licenses.
|
||||||
|
# See https://developer.android.com/studio/#command-tools
|
||||||
|
cmdlineToolsVersion=$(get_toolset_value '.android."cmdline-tools"')
|
||||||
|
if [[ $cmdlineToolsVersion == "latest" ]]; then
|
||||||
|
repositoryXmlUrl="https://dl.google.com/android/repository/repository2-1.xml"
|
||||||
|
download_with_retries $repositoryXmlUrl "/tmp" "repository2-1.xml"
|
||||||
|
cmdlineToolsVersion=$(
|
||||||
|
yq -p=xml \
|
||||||
|
'.sdk-repository.remotePackage[] | select(."+@path" == "cmdline-tools;latest").archives.archive[].complete.url | select(contains("commandlinetools-linux"))' \
|
||||||
|
/tmp/repository2-1.xml
|
||||||
|
)
|
||||||
|
|
||||||
|
if [[ -z $cmdlineToolsVersion ]]; then
|
||||||
|
echo "Failed to parse latest command-line tools version"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cmdlineTools="android-cmdline-tools.zip"
|
|
||||||
download_with_retries "https://dl.google.com/android/repository/${cmdlineToolsVersion}" "." $cmdlineTools
|
download_with_retries "https://dl.google.com/android/repository/${cmdlineToolsVersion}" "." $cmdlineTools
|
||||||
|
fi
|
||||||
|
|
||||||
unzip -qq $cmdlineTools -d ${ANDROID_SDK_ROOT}/cmdline-tools
|
unzip -qq $cmdlineTools -d ${ANDROID_SDK_ROOT}/cmdline-tools
|
||||||
# Command line tools need to be placed in ${ANDROID_SDK_ROOT}/sdk/cmdline-tools/latest to determine SDK root
|
# Command line tools need to be placed in ${ANDROID_SDK_ROOT}/sdk/cmdline-tools/latest to determine SDK root
|
||||||
mv ${ANDROID_SDK_ROOT}/cmdline-tools/cmdline-tools ${ANDROID_SDK_ROOT}/cmdline-tools/latest
|
mv ${ANDROID_SDK_ROOT}/cmdline-tools/cmdline-tools ${ANDROID_SDK_ROOT}/cmdline-tools/latest
|
||||||
|
|||||||
@@ -87,7 +87,6 @@
|
|||||||
"maven": "3.8.7"
|
"maven": "3.8.7"
|
||||||
},
|
},
|
||||||
"android": {
|
"android": {
|
||||||
"cmdline-tools": "latest",
|
|
||||||
"platform_min_version": "23",
|
"platform_min_version": "23",
|
||||||
"build_tools_min_version": "23.0.1",
|
"build_tools_min_version": "23.0.1",
|
||||||
"extra_list": [
|
"extra_list": [
|
||||||
|
|||||||
Reference in New Issue
Block a user