How to compile jni folder telegram

I am trying to compile jni folder in telegram source code in github.com/DrKLO/Telegram/ using ndk

But when I write ndk-build in cmd in the ndk folder as:

F: \ ndk \ android-ndk-r10> ndk-build -CF: \ Workspace \ Android \ Telegram-master-1-12-2016 \ Telegram-master \ TMessagesProj \ jni

I get the wrong errors and libs folder

When I add the ndk path to android studio and add the jni folder manually, android studio says it cannot find the header files

After the question, download Cygwin and use it, but get this error again, for example, ndk-build

$ndkbuild 

[armeabi] SharedLibrary: libtmessages.15.so

process_begin: CreateProcess (........,

F: / NDK / android-NDK-r10 / sources / CXX-STL / gnu-libstdC ++ / 4.8 / LIES / armeabi / thumb / libgnustl _static.a -lgcc -no-canonical-prefixes -Wl, - no - undefined -Wl, -z, noexecstack -Wl, -z, relro -Wl, -z, now -LF: / NDK / android-NDK-r10 / platforms / android- 9 / arch-arm / usr / lib -ljnigraphics -llog -lz -ldl -lc -lm -o F: / Workspace / Android / Telegram-master-1-12-2016 / Telegram-master / TMessagesProj // object / local / armeabi / libtm essages.15.so ,. ..) failed

make (e = 87): parameter is invalid.

make.exe: *** [F: /Workspace/Android/Telegram-master-1-12-2016/Telegram-master/TMessagesProj//obj/local/armeabi/libtmessages.15.so] Error 87

How to fix it?

+5
source share
3 answers

Important update problem: in version 3.18, after downloading the original telegram project, if you go to the jni folder, you will find an empty folder called libtgvoip to fill it with the necessary files: 1- go to the telegram source from githum, goto jni folder and click on the libtgvoip @ eb813e1 folder (@ means that this is the refrence folder). 2- download this library too! 3- copy its contents to the empty folder discussed earlier!

Now let's get started: It's very easy.

1- Add the NDK directory to the PATH environment variable.

2- open Android.mk and add the following line: LOCAL_SHORT_COMMANDS: = true

enter image description here

3- open Application.mk and add the following line: APP_SHORT_COMMANDS: = true

enter image description here

4- open the command line as an administrator and go to the jni folder as follows: (important: in the latest version of the telegram, you must go to the jni parent folder instead of the jni folder)

enter image description here

5 just run the ndk-build command

enter image description here

Then ndk will start creating .so files:

enter image description here

Wait for it to complete the task, maybe some warnings are displayed, but not important. finally, you will have the entire shared library (.so files) in the obj directory: (important: in the latest version of the telegram .so files will be created in the lib folder and everything will be ready to be created)

enter image description here

then go to each of these folders and delete everything except libtmessages.22.so. create the libs folder and copy three directories into it:

enter image description here

Build and have fun! (don't forget to populate the variables in the org.telegram.messenger.BuildVars class with your app id and app_hash. read more here )

+12
source

Just delete the object file. This error probably appeared after the previous assembly was interrupted and the object file was not fully generated. enter image description here

+1
source

Download android-ndk Then go to the project directory (./TMessagesProj) and run ndk-build. Then run the gradle command, which packs your own lib libraries into apk.

0
source

Source: https://habr.com/ru/post/1240443/


All Articles