From 2ede408570babf8abd87c8b8e4cf81a4aa654bd3 Mon Sep 17 00:00:00 2001 From: levlam Date: Mon, 13 May 2024 16:01:28 +0300 Subject: [PATCH] Android example: use build-tools for Android 34 and add support for NDK 26+. --- example/android/README.md | 2 +- example/android/build-openssl.sh | 3 +++ example/android/build-tdlib.sh | 2 +- example/android/fetch-sdk.sh | 2 +- 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/example/android/README.md b/example/android/README.md index c32ec4096..9254a47fe 100644 --- a/example/android/README.md +++ b/example/android/README.md @@ -11,7 +11,7 @@ You need a Bash shell on Linux, macOS, or Windows with some common tools, a C++ * Run the script `./build-tdlib.sh` to build TDLib for Android. * The built libraries are now located in the `tdlib/libs` directory, corresponding Java code is located in the `tdlib/java` directory, and standalone Java documentation can be found in the `tdlib/javadoc` directory. You can also use archives `tdlib/tdlib.zip` and `tdlib/tdlib-debug.zip`, which contain all aforementioned data. -If you already have installed Android SDK and NDK, you can skip the second step and specify existing Android SDK root path and Android NDK version as the first and the second parameters to the subsequent scripts. Make sure that the SDK includes android-33 platform and CMake 3.22.1. +If you already have installed Android SDK and NDK, you can skip the second step and specify existing Android SDK root path and Android NDK version as the first and the second parameters to the subsequent scripts. Make sure that the SDK includes android-34 platform and CMake 3.22.1. If you already have prebuilt OpenSSL, you can skip the third step and specify path to the prebuild OpenSSL as the third parameter to the script `./build-tdlib.sh`. diff --git a/example/android/build-openssl.sh b/example/android/build-openssl.sh index e4b82e06b..b0e35ba92 100755 --- a/example/android/build-openssl.sh +++ b/example/android/build-openssl.sh @@ -49,6 +49,9 @@ ANDROID_API64=21 if [[ ${ANDROID_NDK_VERSION%%.*} -ge 24 ]] ; then ANDROID_API32=19 fi +if [[ ${ANDROID_NDK_VERSION%%.*} -ge 26 ]] ; then + ANDROID_API32=21 +fi for ABI in arm64-v8a armeabi-v7a x86_64 x86 ; do if [[ $ABI == "x86" ]] ; then diff --git a/example/android/build-tdlib.sh b/example/android/build-tdlib.sh index 1ff9ae7af..c7f74d8b4 100755 --- a/example/android/build-tdlib.sh +++ b/example/android/build-tdlib.sh @@ -50,7 +50,7 @@ mv {,tdlib/java/}org/drinkless/tdlib/TdApi.java || exit 1 rm -rf org || exit 1 echo "Generating Javadoc documentation..." -cp "$ANDROID_SDK_ROOT/platforms/android-33/android.jar" . || exit 1 +cp "$ANDROID_SDK_ROOT/platforms/android-34/android.jar" . || exit 1 JAVADOC_SEPARATOR=$([ "$OS_NAME" == "win" ] && echo ";" || echo ":") javadoc -d tdlib/javadoc -encoding UTF-8 -charset UTF-8 -classpath "android.jar${JAVADOC_SEPARATOR}annotation-1.4.0.jar" -quiet -sourcepath tdlib/java org.drinkless.tdlib || exit 1 rm android.jar annotation-1.4.0.jar || exit 1 diff --git a/example/android/fetch-sdk.sh b/example/android/fetch-sdk.sh index 517596281..e36495747 100755 --- a/example/android/fetch-sdk.sh +++ b/example/android/fetch-sdk.sh @@ -27,4 +27,4 @@ mv cmdline-tools/* cmdline-tools/latest/ || exit 1 echo "Installing required SDK tools..." cd cmdline-tools/latest/bin/ || exit 1 yes | $SDKMANAGER --licenses >/dev/null || exit 1 -$SDKMANAGER --install "ndk;$ANDROID_NDK_VERSION" "cmake;3.22.1" "build-tools;33.0.0" "platforms;android-33" > /dev/null || exit 1 +$SDKMANAGER --install "ndk;$ANDROID_NDK_VERSION" "cmake;3.22.1" "build-tools;34.0.0" "platforms;android-34" > /dev/null || exit 1