hi
i want build my project bu I don't want to use your version tdlibjni
The rest of the systems have a complete guide, but the Android file is ready
丕 have android ndk and openssl for android
operion system is linux ubuntu
do not send the download link
https://core.telegram.org/tdlib/tdlib.zip
please provide complete guidance
how can i build it?
The building for Android is hard, so even the instructions are provided, there is a minor chance that they would work for you. Any change in NDK version or installed libraries can cause the build to fail.
We have Java wrapper available at https://github.com/tdlib/td/blob/master/example/java/td_jni.cpp. It could be used on Android almost without modifications, but you would still need to figure out, how to build the C++ project.
I'm ready to try
Which versions of ndk do you use?
for build use ndk cmake or install on os cmake?
Java output cannot be used on Android. Because I need a file armabi-v7 so file.
just give me needed command on ubuntu :-)
can you build example/android directory like example/java for open it with android studio??
@skydeveloper9 Do you want to use native Java interface or JSON interface?
Priority is libtdjni (java native interface)
If not, use libtdjson
In any case, I want to do it myself
Regarding your questions:
Which versions of ndk do you use?
Currently, r19c
for build use ndk cmake or install on os cmake?
OS cmake should be enough.
ok please give me needed command for compile armeabi-v7
please publish android studio sample project to build tdlib jni
i run this command
git checkout tags/v1.6.0 -b v1.6.0;
mkdir build;
cd build;
export CXXFLAGS="";
then
/home/user/Android/Sdk/cmake/3.6.4111459/bin/cmake \
-DANDROID_ABI=armeabi-v7a -DCMAKE_BUILD_TYPE=Release -GNinja \
-DCMAKE_TOOLCHAIN_FILE=/home/user/Android/Sdk/ndk-bundle/build/cmake/android.toolchain.cmake \
-DANDROID_NATIVE_API_LEVEL=27 -DANDROID_TOOLCHAIN=clang \
-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/home/user/github/telegram/android/build \
-DCMAKE_MAKE_PROGRAM=/home/user/Android/Sdk/cmake/3.6.4111459/bin/ninja \
-DANDROID_NDK=/home/user/Android/Sdk/ndk-bundle \
-DOPENSSL_INCLUDE_DIR=/home/user/Downloads/ndk/openssl/armv7/include/ \
-DOPENSSL_ROOT_DIR=/home/user/Downloads/ndk/openssl/armv7 \
-DTD_ENABLE_JNI=ON -DANDROID_STL=c++_static -DCMAKE_INSTALL_PREFIX:PATH=../example/java/td ..
and result is :
-- Performing Test COMPILER_HAS_HIDDEN_VISIBILITY
-- Performing Test COMPILER_HAS_HIDDEN_VISIBILITY - Success
-- Performing Test COMPILER_HAS_HIDDEN_INLINE_VISIBILITY
-- Performing Test COMPILER_HAS_HIDDEN_INLINE_VISIBILITY - Success
-- Performing Test COMPILER_HAS_DEPRECATED_ATTR
-- Performing Test COMPILER_HAS_DEPRECATED_ATTR - Success
-- Configuring done
-- Generating done
/home/user/Android/Sdk/cmake/3.6.4111459/bin/cmake --build . --target install
showing this error
[77/308] Building CXX object tdutils/CMakeFiles/tdutils.dir/generate/auto/mime_type_to_extension.cpp.o
FAILED: ccache /home/user/Downloads/ndk/android-ndk-r19c/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ --target=armv7-none-linux-androideabi27 --gcc-toolchain=/home/user/Downloads/ndk/android-ndk-r19c/toolchains/llvm/prebuilt/linux-x86_64 --sysroot=/home/user/Downloads/ndk/android-ndk-r19c/toolchains/llvm/prebuilt/linux-x86_64/sysroot -I../tdutils -Itdutils -isystem /home/user/Desktop/openssl/output/include -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -mfpu=vfpv3-d16 -fno-addrsig -march=armv7-a -mthumb -mfpu=neon -Wa,--noexecstack -Wformat -Werror=format-security -stdlib=libc++ -std=c++14 -fno-omit-frame-pointer -fno-exceptions -fno-rtti -ffunction-sections -fdata-sections -Wall -Wextra -Wpointer-arith -Wcast-qual -Wsign-compare -Wno-tautological-compare -Wpointer-arith -Wvla -Wnon-virtual-dtor -Wno-unused-parameter -Wconversion -Wno-sign-conversion -Wc++14-compat-pedantic -Wdeprecated -Qunused-arguments -Wodr -Oz -DNDEBUG -fPIC -Wno-conversion -Wno-deprecated-register -MD -MT tdutils/CMakeFiles/tdutils.dir/generate/auto/mime_type_to_extension.cpp.o -MF tdutils/CMakeFiles/tdutils.dir/generate/auto/mime_type_to_extension.cpp.o.d -o tdutils/CMakeFiles/tdutils.dir/generate/auto/mime_type_to_extension.cpp.o -c /home/user/github/telegram/android/tdutils/generate/auto/mime_type_to_extension.cpp
clang++: error: no such file or directory: '/home/user/github/telegram/android/tdutils/generate/auto/mime_type_to_extension.cpp'
clang++: error: no input files
[77/308] Building CXX object tdutils/CMakeFiles/tdutils.dir/generate/auto/extension_to_mime_type.cpp.o
FAILED: ccache /home/user/Downloads/ndk/android-ndk-r19c/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ --target=armv7-none-linux-androideabi27 --gcc-toolchain=/home/user/Downloads/ndk/android-ndk-r19c/toolchains/llvm/prebuilt/linux-x86_64 --sysroot=/home/user/Downloads/ndk/android-ndk-r19c/toolchains/llvm/prebuilt/linux-x86_64/sysroot -I../tdutils -Itdutils -isystem /home/user/Desktop/openssl/output/include -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -mfpu=vfpv3-d16 -fno-addrsig -march=armv7-a -mthumb -mfpu=neon -Wa,--noexecstack -Wformat -Werror=format-security -stdlib=libc++ -std=c++14 -fno-omit-frame-pointer -fno-exceptions -fno-rtti -ffunction-sections -fdata-sections -Wall -Wextra -Wpointer-arith -Wcast-qual -Wsign-compare -Wno-tautological-compare -Wpointer-arith -Wvla -Wnon-virtual-dtor -Wno-unused-parameter -Wconversion -Wno-sign-conversion -Wc++14-compat-pedantic -Wdeprecated -Qunused-arguments -Wodr -Oz -DNDEBUG -fPIC -Wno-conversion -Wno-deprecated-register -MD -MT tdutils/CMakeFiles/tdutils.dir/generate/auto/extension_to_mime_type.cpp.o -MF tdutils/CMakeFiles/tdutils.dir/generate/auto/extension_to_mime_type.cpp.o.d -o tdutils/CMakeFiles/tdutils.dir/generate/auto/extension_to_mime_type.cpp.o -c /home/user/github/telegram/android/tdutils/generate/auto/extension_to_mime_type.cpp
clang++: error: no such file or directory: '/home/user/github/telegram/android/tdutils/generate/auto/extension_to_mime_type.cpp'
clang++: error: no input files
[77/308] Building C object sqlite/CMakeFiles/tdsqlite.dir/sqlite/sqlite3.c.o
clang: warning: argument unused during compilation: '-Wa,--noexecstack' [-Wunused-command-line-argument]
[77/308] Generate git_commit.h
ninja: build stopped: subcommand failed.
wht's wrong???
You need to generate some source files first:
mkdir native_build
cd native_build
cmake ..
cmake --build . --target prepare_cross_compiling
tank you @levlam thats work
/home/user/Android/Sdk/cmake/3.6.4111459/bin/cmake --build . --target install;
show this error
ninja: error: '../td/bin/td_generate_java_api', needed by 'CMakeFiles/td_generate_java_api', missing and no known rule to make it
and without ninja is this
make[2]: *** No rule to make target '../td/bin/td/generate/JavadocTlDocumentationGenerator.php', needed by 'CMakeFiles/td_generate_java_api'. Stop.
CMakeFiles/Makefile2:170: recipe for target 'CMakeFiles/td_generate_java_api.dir/all' failed
make[1]: *** [CMakeFiles/td_generate_java_api.dir/all] Error 2
Makefile:127: recipe for target 'all' failed
make: *** [all] Error 2
Which step was wrong?
when use prepare_cross_compiling not generate td_generate_java_api file
I prepared scripts which can be used to build all flavours of TDLib for Android. You will need Bash, cmake, ninja, C++14 compatible compiler, PHP (optional, for documentation generation), Android NDK and system JDK preinstalled. Make sure that ANDROID_SDK_ROOT environment variable is correctly set before using the scripts.
You can build desired TDLib version using:
libtdjni.zip - native JNI wrapper for TDLib with autogenerated Java classes.
libtdjsonandroid.zip - TDLib JSON interface built for Android. All TDLib JSON interface methods have ordinary names prefixed with undescore, for example _td_json_client_create.
libtdjsonjava.zip - JNI wrapper for TDLib JSON interface.
You will need to unpack the desired archive to td/example directory. Then download the latest OpenSSL 1.1.1 source code as a .tar.gz archive from OpenSSL 1.1.1 release page and place it in the third_party/crypto subfolder. After that you need to adjust variables ANDROID_NDK and HOST_ARCH in third_party/crypto/build.sh and run third_party/crypto/build-all.sh script to build OpenSSL.
After that run the script build-all.sh in the unpacked archive top-level directory to build TDLib.
duplicate https://github.com/tdlib/td/issues/77
duplicate #77
@levlambot Yes. You're right. It is rather more like a repeat.
@skydeveloper9 Have you succeeded?
@skydeveloper9 Have you succeeded?
its work.
But a better way is to put an example of an Android app in example directory like another
thanks
Most helpful comment
I prepared scripts which can be used to build all flavours of TDLib for Android. You will need Bash, cmake, ninja, C++14 compatible compiler, PHP (optional, for documentation generation), Android NDK and system JDK preinstalled. Make sure that
ANDROID_SDK_ROOTenvironment variable is correctly set before using the scripts.You can build desired TDLib version using:
libtdjni.zip - native JNI wrapper for TDLib with autogenerated Java classes.
libtdjsonandroid.zip - TDLib JSON interface built for Android. All TDLib JSON interface methods have ordinary names prefixed with undescore, for example
_td_json_client_create.libtdjsonjava.zip - JNI wrapper for TDLib JSON interface.
You will need to unpack the desired archive to
td/exampledirectory. Then download the latest OpenSSL 1.1.1 source code as a .tar.gz archive from OpenSSL 1.1.1 release page and place it in thethird_party/cryptosubfolder. After that you need to adjust variablesANDROID_NDKandHOST_ARCHinthird_party/crypto/build.shand runthird_party/crypto/build-all.shscript to build OpenSSL.After that run the script
build-all.shin the unpacked archive top-level directory to build TDLib.