preload-hacks: Some patches to make it work.
[termux-packages] / scripts / setup-android-sdk.sh
index 54bc68d..d5c1e17 100755 (executable)
@@ -11,8 +11,12 @@ if [ ! -d $ANDROID_HOME ]; then
        cd $ANDROID_HOME/..
        rm -Rf `basename $ANDROID_HOME`
 
-       curl --fail --retry 3 -o tools.zip https://dl.google.com/android/repository/tools_r25.2.3-linux.zip
-       rm -Rf tools android-sdk
+       # https://developer.android.com/studio/index.html#command-tools
+       # The downloaded version below is 26.0.1.:
+       curl --fail --retry 3 \
+               -o tools.zip \
+               https://dl.google.com/android/repository/sdk-tools-linux-3859397.zip
+       rm -Rf android-sdk
        unzip -q tools.zip -d android-sdk
        rm tools.zip
 fi
@@ -21,7 +25,7 @@ if [ ! -d $NDK ]; then
        mkdir -p $NDK
        cd $NDK/..
        rm -Rf `basename $NDK`
-       NDK_VERSION=r13
+       NDK_VERSION=r16
        curl --fail --retry 3 -o ndk.zip \
                http://dl.google.com/android/repository/android-ndk-${NDK_VERSION}-`uname`-x86_64.zip
 
@@ -31,4 +35,7 @@ if [ ! -d $NDK ]; then
        rm ndk.zip
 fi
 
-echo y | $ANDROID_HOME/tools/android update sdk --no-ui --all --no-https -t "build-tools-25.0.1,android-24"
+yes | $ANDROID_HOME/tools/bin/sdkmanager --licenses
+
+# The android-21 platform is used in the ecj package:
+$ANDROID_HOME/tools/bin/sdkmanager "build-tools;27.0.3" "platforms;android-27" "platforms;android-21"