summaryrefslogtreecommitdiff
path: root/buildscripts/setup-android-toolchain.sh
blob: 9d2f5f08151825c19390b4c2209c28b1f53ee994 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/bin/sh

set -o verbose
set -o errexit

SDK_ROOT=$1
if [ -z $SDK_ROOT ]; then
    echo "usage: $0 <sdk-root>"
    exit 1
fi
shift

NDK=android-ndk-r19c
NDK_PACKAGE=$NDK-linux-x86_64.zip
# The releases of the sdk tools are published at
#   https://developer.android.com/studio/releases/sdk-tools
SDK_PACKAGE=sdk-tools-linux-4333796.zip # 26.1.1

test -e $SDK_PACKAGE || curl -O https://dl.google.com/android/repository/$SDK_PACKAGE
test -e $NDK_PACKAGE || curl -O https://dl.google.com/android/repository/$NDK_PACKAGE

if [ ! -e  $SDK_ROOT ]; then
    mkdir $SDK_ROOT
    (
        cd $SDK_ROOT
        unzip -q ../$SDK_PACKAGE
        yes | ./tools/bin/sdkmanager --channel=0 \
            "build-tools;28.0.0" \
            "emulator"  \
            "patcher;v4"  \
            "platforms;android-28"  \
            "platform-tools"  \
            "system-images;android-24;google_apis;arm64-v8a"  \
            "system-images;android-24;google_apis;armeabi-v7a"  \
            "system-images;android-24;google_apis;x86_64" \
        | grep -v Unzipping
    )
    unzip -q $NDK_PACKAGE
    mv $NDK $SDK_ROOT/ndk-bundle
fi