Saturday, September 5, 2015

Building libjingle for Android

Libjingle is a C++ library used to create peer-to-peer connections for voice-chat applications. It is included in WebRTC and bundled inside the Chromium source repository.
There are a couple of web pages with instructions out there about how to build the library for Android, but none of them seem complete.
This is where this post comes in.

The steps to build libjingle for Android would be these:

  1. Install depot tools - 
  2. Install the prerequisite software -
  3. Run the following commands to get the sources:
  4. mkdir webrtc-checkout
    cd webrtc-checkout
    fetch webrtc
  5. Run the following commands to configure the build environment:
  6. echo "target_os = ['android', 'unix']" >> .gclient
    cd src
    source ./build/android/
    export GYP_DEFINES="$GYP_DEFINES build_with_libjingle=1 build_with_chromium=0 libjingle_java=1 OS=android"
    gclient runhooks --force
  7. Start the build for
  8. ninja -C out/Debug libjingle_peerconnection_so
After the build is done you can check the resulting artifact in out/Debug/lib/.

To try out libjingle on Android you can compile the AppRTCDemo application:
ninja -C out/Debug AppRTCDemo
You will get an apk in out/Debug/apks, which you can install and then go to and create a video chat room, and then connect with the Android app.
A working video call should look like this:


No comments:

Post a Comment