Back in 2015 I had compiled WebRTC codebase for android as I needed WebRTC's VoiceEngine library for android. Link given below.
The library compiled then was 32 bit only and starting August 2019 Google has mandated to include support for 64 bit native libraries.
Thus, there was need to recompile the codebase and generate the said library again.
For this, I have used the same VM as explained in link above.
This time, I used VirtualBox 6 and MacOS Mojave 10.14.6.
Initially I faced an issue importing the the VM file(Ubuntu-14.04.2.ova) but installing
VirtualBox extension pack did the trick and the VM came back to life.
Another issue I faced was that Chrome browser being used on the VM Ubuntu was quite old and wasn't responding, I wanted to upgrade but I don't the remember the password for the VM :P
Next steps remain invariably the same except for 1 modification for 64 bit and 1 correction.
cd Documents/work/android/webrtc/webrtcFresh/
export PATH=`pwd`/depot_tools:"$PATH"
export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64/
#for 32 bit devices below command
export GYP_DEFINES="OS=android"
#for 64 bit devices below command
#export GYP_DEFINES="OS=android target_arch=arm64 target_subarch=arm64"
cd /home/azhar/Documents/work/android/webrtc/webrtcFresh/WebCRT/src
. build/android/envsetup.sh
export GYP_DEFINES="build_with_chromium=0 $GYP_DEFINES"
export GYP_DEFINES="build_with_libjingle=1 $GYP_DEFINES"
export GYP_DEFINES="libjingle_java=1 $GYP_DEFINES"
export GYP_DEFINES="enable_tracing=1 $GYP_DEFINES"
gclient runhooks
- The above command generates all the ninja files required to build the webrtc libs. Path of ninja files is as mentioned below:-
for debug mode - WebCRT/src/webrtc/obj/Debug/webrtc/
for release mode - WebCRT/src/webrtc/obj/Release/webrtc/
above path is incorrect,
corrrect path-WebCRT/src/out/Release/obj
Before building the libs edit the libwebrtc-jni.ninja to remove the -fno-rtti flag from cflags_cc parameter, it is required because some additional code is added in the JNI wrapper to make it work with SabaMeeting.
ninja -C out/Debug #builds in debug mode
ninja -C out/Release #builds in Release mode
- Post successful builds the final libwebrtc-jni.so will get generated at
/Documents/work/android/webrtc/webrtcFresh/WebCRT/src/webrtc/examples/android/media_demo/libs/armeabi-v7a
- Incase the jni wrapper needs to be modified, media_demo/jni contains the JNI wrapper.
Note: Important point to note here before beginning is that the WebRTC codebase should not updated, as the WebRTC implementation has changed significantly and I could not find the VoiceEngine library in the latest codebase.