tdlight/example/android
2022-10-07 01:47:03 +03:00
..
.gitignore Add .gitignore for Android example. 2022-08-12 10:34:14 +03:00
AddIntDef.php Android example: improve AddIntDef.php. 2022-08-14 16:26:40 +03:00
build-openssl.sh Android example: avoid using of unsupported API versions with new NDK. 2022-08-14 15:24:40 +03:00
build-tdlib.sh Android example: avoid usage of case, which doesn't seem to work in outdated default bash on macOS. 2022-08-15 10:33:15 +03:00
check-environment.sh Add check for JDK to be actually installed. macOS has dummy /usr/bin/java. 2022-08-15 01:00:19 +03:00
CMakeLists.txt Allow to specify custom path for prebuilt Android OpenSSL. 2022-08-13 10:31:41 +03:00
Dockerfile Add Dockerfile for Android example. 2022-10-07 01:47:03 +03:00
fetch-sdk.sh Android example: change working directory after resolving relative paths. 2022-08-14 13:23:09 +03:00
README.md Add Dockerfile for Android example. 2022-10-07 01:47:03 +03:00

TDLib Android example

This is an example of building TDLib for Android. You need a Bash shell on Linux, macOS, or Windows with some common tools, a C++ compiler, JDK, PHP, perl, and gperf pre-installed.

Building TDLib for Android

  • Run the script ./check-environment.sh to check that you have all required Unix tools and Java utilities. If the script exits with an error message, install the missing tool.
  • Run the script ./fetch-sdk.sh to download Android SDK to a local directory.
  • Run the script ./build-openssl.sh to download and build OpenSSL 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.

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.

If you want to update TDLib to a newer version, you need to run only the script ./build-tdlib.sh.

You can specify different OpenSSL version as the fourth parameter to the script ./build-openssl.sh. By default OpenSSL 1.1.1 is used because of much smaller binary footprint and better performance than newer OpenSSL versions.

You can build TDLib against shared standard C++ library by specifying "c++_shared" as the fourth parameter to the script ./build-tdlib.sh. This can reduce total application size if you have a lot of other C++ code and want it to use the same shared library.

Alternatively, you can use Docker to build TDLib for Android. Use docker build --output tdlib . to build the latest TDLib commit from Github, or docker build --build-arg COMMIT_HASH=<commit-hash> --output tdlib . to build specific commit. The output archives will be placed in the tdlib directory as specified.