Last active
August 17, 2022 23:54
-
-
Save homuler/956bcc93a2c40fc193faa7f1b13dd568 to your computer and use it in GitHub Desktop.
A script to work around a bug that for some reason prevents Android-related commands from being executable on Linux.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Android-related commands are somewhat not executable on Linux, so install them again. | |
# cf. https://forum.unity.com/threads/android-sdk-ndk-and-openjdk-arent-marked-with-executable-permission-on-linux.1238494/ | |
UNITY_EDITOR_ROOT="/path/to/Unity/Hub/Editor" | |
UNITY_EDITOR_VERSION="2021.3.3f1" | |
DESTINATION_ROOT="${UNITY_EDITOR_ROOT}/${UNITY_EDITOR_VERSION}/Editor/Data/PlaybackEngines/AndroidPlayer" | |
ANDROID_OPEN_JDK_URL=http://download.unity3d.com/download_unity/open-jdk/open-jdk-linux-x64/jdk8u172-b11_4be8440cc514099cfe1b50cbc74128f6955cd90fd5afe15ea7be60f832de67b4.zip | |
ANDROID_SDK_NDK_TOOLS_URL=https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip | |
ANDROID_SDK_PLATFORMS_29_URL=https://dl.google.com/android/repository/platform-29_r05.zip | |
ANDROID_NDK_URL=https://dl.google.com/android/repository/android-ndk-r21d-linux-x86_64.zip | |
ANDROID_SDK_PLATFORM_TOOLS_URL=https://dl.google.com/android/repository/platform-tools_r30.0.4-linux.zip | |
ANDROID_SDK_PLATFORMS_30_URL=https://dl.google.com/android/repository/platform-30_r03.zip | |
ANDROID_SDK_BUILD_TOOLS_URL=https://dl.google.com/android/repository/build-tools_r30.0.2-linux.zip | |
# install android-open-jdk | |
ANDROID_OPEN_JDK_TMP_PATH=/tmp/android-open-jdk.zip | |
curl -X GET ${ANDROID_OPEN_JDK_URL} -o ${ANDROID_OPEN_JDK_TMP_PATH} | |
unzip -o ${ANDROID_OPEN_JDK_TMP_PATH} -d ${DESTINATION_ROOT}/OpenJDK | |
rm ${ANDROID_OPEN_JDK_TMP_PATH} | |
# install android-sdk-ndk-tools | |
ANDROID_SDK_NDK_TOOLS_TMP_PATH=/tmp/android-sdk-ndk-tools.zip | |
curl -X GET ${ANDROID_SDK_NDK_TOOLS_URL} -o ${ANDROID_SDK_NDK_TOOLS_TMP_PATH} | |
unzip -o ${ANDROID_SDK_NDK_TOOLS_TMP_PATH} -d ${DESTINATION_ROOT}/SDK | |
rm ${ANDROID_SDK_NDK_TOOLS_TMP_PATH} | |
# install android-sdk-platforms-29 | |
ANDROID_SDK_PLATFORMS_29_TMP_PATH=/tmp/android-sdk-platforms-29.zip | |
curl -X GET ${ANDROID_SDK_PLATFORMS_29_URL} -o ${ANDROID_SDK_PLATFORMS_29_TMP_PATH} | |
unzip -o ${ANDROID_SDK_PLATFORMS_29_TMP_PATH} -d ${DESTINATION_ROOT}/SDK/platforms | |
rm ${ANDROID_SDK_PLATFORMS_29_TMP_PATH} | |
# install android-ndk | |
ANDROID_NDK_TMP_PATH=/tmp/android-ndk.zip | |
curl -X GET ${ANDROID_NDK_URL} -o ${ANDROID_NDK_TMP_PATH} | |
unzip -o ${ANDROID_NDK_TMP_PATH} -d /tmp/NDK | |
cp -rp /tmp/NDK/android-ndk-r21d/* ${DESTINATION_ROOT}/NDK | |
rm -rf /tmp/NDK | |
rm ${ANDROID_NDK_TMP_PATH} | |
# install android-sdk-platform-tools | |
ANDROID_SDK_PLATFORM_TOOLS_TMP_PATH=/tmp/android-sdk-platform-tools.zip | |
curl -X GET ${ANDROID_SDK_PLATFORM_TOOLS_URL} -o ${ANDROID_SDK_PLATFORM_TOOLS_TMP_PATH} | |
unzip -o ${ANDROID_SDK_PLATFORM_TOOLS_TMP_PATH} -d ${DESTINATION_ROOT}/SDK | |
rm ${ANDROID_SDK_PLATFORM_TOOLS_TMP_PATH} | |
# install android-sdk-platforms-30 | |
ANDROID_SDK_PLATFORMS_30_TMP_PATH=/tmp/android-sdk-platforms-30.zip | |
curl -X GET ${ANDROID_SDK_PLATFORMS_30_URL} -o ${ANDROID_SDK_PLATFORMS_30_TMP_PATH} | |
unzip -o ${ANDROID_SDK_PLATFORMS_30_TMP_PATH} -d ${DESTINATION_ROOT}/SDK/platforms | |
rm ${ANDROID_SDK_PLATFORMS_30_TMP_PATH} | |
# install android-sdk-build-tools | |
ANDROID_SDK_BUILD_TOOLS_TMP_PATH=/tmp/android-sdk-build-tools.zip | |
curl -X GET ${ANDROID_SDK_BUILD_TOOLS_URL} -o ${ANDROID_SDK_BUILD_TOOLS_TMP_PATH} | |
unzip -o ${ANDROID_SDK_BUILD_TOOLS_TMP_PATH} -d ${DESTINATION_ROOT}/SDK/build-tools | |
rm ${ANDROID_SDK_BUILD_TOOLS_TMP_PATH} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment