Android example: use build-tools for Android 34 and add support for NDK 26+.

This commit is contained in:
levlam 2024-05-13 16:01:28 +03:00
parent 02a096fcbe
commit 2ede408570
4 changed files with 6 additions and 3 deletions

View File

@ -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. * 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. * 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`. 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`.

View File

@ -49,6 +49,9 @@ ANDROID_API64=21
if [[ ${ANDROID_NDK_VERSION%%.*} -ge 24 ]] ; then if [[ ${ANDROID_NDK_VERSION%%.*} -ge 24 ]] ; then
ANDROID_API32=19 ANDROID_API32=19
fi fi
if [[ ${ANDROID_NDK_VERSION%%.*} -ge 26 ]] ; then
ANDROID_API32=21
fi
for ABI in arm64-v8a armeabi-v7a x86_64 x86 ; do for ABI in arm64-v8a armeabi-v7a x86_64 x86 ; do
if [[ $ABI == "x86" ]] ; then if [[ $ABI == "x86" ]] ; then

View File

@ -50,7 +50,7 @@ mv {,tdlib/java/}org/drinkless/tdlib/TdApi.java || exit 1
rm -rf org || exit 1 rm -rf org || exit 1
echo "Generating Javadoc documentation..." 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_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 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 rm android.jar annotation-1.4.0.jar || exit 1

View File

@ -27,4 +27,4 @@ mv cmdline-tools/* cmdline-tools/latest/ || exit 1
echo "Installing required SDK tools..." echo "Installing required SDK tools..."
cd cmdline-tools/latest/bin/ || exit 1 cd cmdline-tools/latest/bin/ || exit 1
yes | $SDKMANAGER --licenses >/dev/null || 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