Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Build PJSIP for Android on Windows?

I am beginner with Android and I have to make a voip app and after searching I found that the better opensource library for that is PJSIP. I download the below things to build the PJSIP library:

  1. PJSIP from here

  2. Android NDK

  3. SWIG

...But I don't know how to start. I checked this link for the official PJSIP website but I didn't make any progress.

Which Directory do I have to put the Android NDK into?

How to use SWIG to build the PJSIP?!

like image 916
Ahmed Gamal Avatar asked Oct 31 '22 15:10

Ahmed Gamal


1 Answers

which Directory i have to put the Android NDK ?

Put it where you want, later you will setup the path to it

$ export ANDROID_NDK_ROOT=/path_to_android_ndk_dir 

how to use SWIG to build the PJSIP ?!

You don't need SWIG to compile the PJSIP sources, it's needed only if you want to build and and run the sample application PJSUA.

Updated

The steps to build sources are

  1. Download sources from PJSIP site. Pay attention if you will compile on Windows machine download .zip file, if on Unix machine (including OS X) then download .bz2 file.

  2. Go to pjlib/include/pj/ from the downloaded sources. Create (or overwrite) a file called config_site.h. Copy the following code snippet

    #define PJ_CONFIG_ANDROID 1
    #include <pj/config_site_sample.h>
    
  3. Open Cmd or Terminal

  4. Go to pjsip root folder (the downloaded sources)

    $ cd /path/to/your/pjsip/dir

  5. Export bash var ANDROID_NDK_ROOT as a environment variable. Variable value should be the path of android ndk directory.

    $ export ANDROID_NDK_ROOT=/path_to_android_ndk_dir (Unix)

    SET ANDROID_NDK_ROOT=/path_to_android_ndk_dir (Windows)

  6. Perform build for target armeabi

    $ ./configure-android

If you need to perform build for target arm64-v8a do $ TARGET_ABI=armeabi-v8a ./configure-android --use-ndk-cflags

target armeabi-v7a do $ TARGET_ABI=armeabi-v7a ./configure-android --use-ndk-cflags

target x86 do $ TARGET_ABI=x86 ./configure-android --use-ndk-cflags

  1. Compile sources

    $ make dep && make clean && make

like image 198
nsinvocation Avatar answered Nov 12 '22 19:11

nsinvocation