termux-packages/scripts/setup-android-sdk.sh

52 lines
1.7 KiB
Bash
Raw Normal View History

2016-05-28 00:24:50 +02:00
#!/bin/sh
set -e -u
# Install desired parts of the Android SDK:
. $(cd "$(dirname "$0")"; pwd)/properties.sh
2021-09-16 21:51:29 +02:00
ANDROID_SDK_FILE=commandlinetools-linux-7583922_latest.zip
ANDROID_SDK_SHA256=124f2d5115eee365df6cf3228ffbca6fc3911d16f8025bebd5b1c6e2fcfa7faf
ANDROID_NDK_FILE=android-ndk-r${TERMUX_NDK_VERSION}-linux.zip
ANDROID_NDK_SHA256=c6e97f9c8cfe5b7be0a9e6c15af8e7a179475b7ded23e2d1c1fa0945d6fb4382
2016-05-28 00:24:50 +02:00
if [ ! -d $ANDROID_HOME ]; then
mkdir -p $ANDROID_HOME
cd $ANDROID_HOME/..
2019-02-12 09:41:30 +01:00
rm -Rf $(basename $ANDROID_HOME)
2016-05-28 00:24:50 +02:00
# https://developer.android.com/studio/index.html#command-tools
# The downloaded version below is 26.1.1.:
echo "Downloading android sdk..."
curl --fail --retry 3 \
-o tools.zip \
https://dl.google.com/android/repository/${ANDROID_SDK_FILE}
echo "${ANDROID_SDK_SHA256} tools.zip" | sha256sum -c -
rm -Rf android-sdk
unzip -q tools.zip -d android-sdk
rm tools.zip
2016-05-28 00:24:50 +02:00
fi
if [ ! -d $NDK ]; then
mkdir -p $NDK
cd $NDK/..
2019-02-12 09:41:30 +01:00
rm -Rf $(basename $NDK)
echo "Downloading android ndk..."
curl --fail --retry 3 -o ndk.zip \
https://dl.google.com/android/repository/${ANDROID_NDK_FILE}
echo "${ANDROID_NDK_SHA256} ndk.zip" | sha256sum -c -
rm -Rf android-ndk-r$TERMUX_NDK_VERSION
2016-05-28 00:24:50 +02:00
unzip -q ndk.zip
2019-02-12 09:41:30 +01:00
mv android-ndk-r$TERMUX_NDK_VERSION $(basename $NDK)
2016-05-28 00:24:50 +02:00
rm ndk.zip
fi
2021-09-16 21:51:29 +02:00
yes | $ANDROID_HOME/cmdline-tools/bin/sdkmanager --sdk_root=$ANDROID_HOME --licenses
# The android platforms are used in the ecj and apksigner packages:
2021-09-16 21:51:29 +02:00
yes | $ANDROID_HOME/cmdline-tools/bin/sdkmanager --sdk_root=$ANDROID_HOME \
"platform-tools" \
"build-tools;${TERMUX_ANDROID_BUILD_TOOLS_VERSION}" \
"platforms;android-32" \
2021-09-16 21:51:29 +02:00
"platforms;android-28" \
"platforms;android-24" \
"platforms;android-21"