diff --git a/example/android/README.md b/example/android/README.md index fbe3b663a..7c41a295d 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. +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 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-tdlib.sh b/example/android/build-tdlib.sh index 14d387387..7ee86ab7a 100755 --- a/example/android/build-tdlib.sh +++ b/example/android/build-tdlib.sh @@ -23,6 +23,11 @@ if [ ! -d "$OPENSSL_INSTALL_DIR" ] ; then exit 1 fi +ANDROID_SDK_ROOT="$(cd "$(dirname -- "$ANDROID_SDK_ROOT")" >/dev/null; pwd -P)/$(basename -- "$ANDROID_SDK_ROOT")" +ANDROID_NDK_ROOT="$ANDROID_SDK_ROOT/ndk/$ANDROID_NDK_VERSION" +OPENSSL_INSTALL_DIR="$(cd "$(dirname -- "$OPENSSL_INSTALL_DIR")" >/dev/null; pwd -P)/$(basename -- "$OPENSSL_INSTALL_DIR")" +PATH=$ANDROID_SDK_ROOT/cmake/3.22.1/bin:$PATH + echo "Downloading annotation Java package..." rm -f android.jar annotation-1.4.0.jar || exit 1 $WGET https://maven.google.com/androidx/annotation/annotation/1.4.0/annotation-1.4.0.jar || exit 1 @@ -43,10 +48,6 @@ cp -p {../../example,tdlib}/java/org/drinkless/tdlib/Client.java || exit 1 mv {,tdlib/java/}org/drinkless/tdlib/TdApi.java || exit 1 rm -rf org || exit 1 -ANDROID_SDK_ROOT="$(cd "$(dirname -- "$ANDROID_SDK_ROOT")" >/dev/null; pwd -P)/$(basename -- "$ANDROID_SDK_ROOT")" -ANDROID_NDK_ROOT="$ANDROID_SDK_ROOT/ndk/$ANDROID_NDK_VERSION" -OPENSSL_INSTALL_DIR="$(cd "$(dirname -- "$OPENSSL_INSTALL_DIR")" >/dev/null; pwd -P)/$(basename -- "$OPENSSL_INSTALL_DIR")" - echo "Generating Javadoc documentation..." cp "$ANDROID_SDK_ROOT/platforms/android-33/android.jar" . || exit 1 javadoc -d tdlib/javadoc -encoding UTF-8 -charset UTF-8 -classpath "*" -quiet -sourcepath tdlib/java org.drinkless.tdlib || exit 1 diff --git a/example/android/check-environment.sh b/example/android/check-environment.sh index ff9af17a7..f3bdf960d 100755 --- a/example/android/check-environment.sh +++ b/example/android/check-environment.sh @@ -25,7 +25,7 @@ else exit 1 fi -for TOOL_NAME in cmake gperf jar javadoc make perl php sed tar yes unzip ; do +for TOOL_NAME in gperf jar javadoc make perl php sed tar yes unzip ; do if ! which "$TOOL_NAME" >/dev/null 2>&1 ; then echo "Error: this script requires $TOOL_NAME tool installed." exit 1 diff --git a/example/android/fetch-sdk.sh b/example/android/fetch-sdk.sh index ce8e34d5a..f814ede99 100755 --- a/example/android/fetch-sdk.sh +++ b/example/android/fetch-sdk.sh @@ -28,4 +28,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 "platform-tools" "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;33.0.0" "platforms;android-33" > /dev/null || exit 1