wiki:Getting-Started/Android

Version 12 (modified by bennylp, 12 years ago) (diff)

--

Getting Started: Building for Android

  1. Requirements
  2. Build Preparation
  3. Building PJSIP
  4. Building and running apjsua sample application
  5. Other Android projects

Android target is currently available in Android branch and currently still experimental.

Requirements

Build Preparation

  1. Get the source code, if you haven't already.
  2. Set your config_site.h to the following:
    #define PJ_CONFIG_ANDROID 1
    #include <pj/config_site_sample.h>
    
    This will activate Android specific settings in the config_site_sample.h.

Building PJSIP

Just run:

$ cd /path/to/your/pjsip/dir
$ export ANDROID_NDK_ROOT=/path_to_android_ndk_dir 
$ ./configure-android
$ make dep && make clean && make

Notes:

  • the ./configure-android is a wrapper that calls the standard ./configure script with settings suitable for Android target.
  • you may pass standard ./configure options to this script too.
  • for more info, run ./configure-android --help
  • other customizations are similar to what is explained in Building with GNU page.

Building and running apjsua sample application

We have apjsua sample application located under pjsip-apps/src/apjsua. It is not built by default, and you need SWIG to build it.

Follow these steps to build apjsua:

  1. (Re)Compile pjsua with USE_GUI defined.
  2. Go to apjsua source directory:
    $ cd pjsip-apps/src/apjsua
    
  3. Make sure swig is in the PATH and build the app:
    $ make
    
  4. Create Android project from apjsua. In Eclipse:
    1. From menu: File --> New --> Project
    2. Select Android Project from Existing Code, press Next
    3. In Root Directory, put the location of apjsua source code (i.e. $PJDIR/pjsip-apps/src/apjsua) and press Finish
  5. You may need to select different Android SDK than what is configured in apjsua. You can do this from the project's Properties.
  6. You can modify apjsua/res/raw/config.txt for apjsua's config file.
  7. Run it.

Other Android projects

Also have a look at the following PJSIP Android project: