| 1 | #!/bin/sh |
| 2 | set -e -u |
| 3 | |
| 4 | # Install desired parts of the Android SDK: |
| 5 | test -f $HOME/.termuxrc && . $HOME/.termuxrc |
| 6 | : ${ANDROID_HOME:="${HOME}/lib/android-sdk"} |
| 7 | : ${NDK:="${HOME}/lib/android-ndk"} |
| 8 | |
| 9 | if [ ! -d $ANDROID_HOME ]; then |
| 10 | mkdir -p $ANDROID_HOME |
| 11 | cd $ANDROID_HOME/.. |
| 12 | rm -Rf `basename $ANDROID_HOME` |
| 13 | |
| 14 | # https://developer.android.com/studio/index.html#command-tools |
| 15 | # The downloaded version below is 26.0.1.: |
| 16 | curl --fail --retry 3 \ |
| 17 | -o tools.zip \ |
| 18 | https://dl.google.com/android/repository/sdk-tools-linux-3859397.zip |
| 19 | rm -Rf android-sdk |
| 20 | unzip -q tools.zip -d android-sdk |
| 21 | rm tools.zip |
| 22 | fi |
| 23 | |
| 24 | if [ ! -d $NDK ]; then |
| 25 | mkdir -p $NDK |
| 26 | cd $NDK/.. |
| 27 | rm -Rf `basename $NDK` |
| 28 | NDK_VERSION=r14 |
| 29 | curl --fail --retry 3 -o ndk.zip \ |
| 30 | http://dl.google.com/android/repository/android-ndk-${NDK_VERSION}-`uname`-x86_64.zip |
| 31 | |
| 32 | rm -Rf android-ndk-$NDK_VERSION |
| 33 | unzip -q ndk.zip |
| 34 | mv android-ndk-$NDK_VERSION `basename $NDK` |
| 35 | rm ndk.zip |
| 36 | fi |
| 37 | |
| 38 | mkdir $ANDROID_HOME/licenses |
| 39 | echo -e -n "\n8933bad161af4178b1185d1a37fbf41ea5269c55" > $ANDROID_HOME/licenses/android-sdk-license |
| 40 | $ANDROID_HOME/tools/bin/sdkmanager "build-tools;25.0.3" "platforms;android-25" |