Search Tutorials

Thursday 9 April 2015

Start working on Linphone Android - Part 1

Linphone is free VoIP(Voice over Internet Protocol) phone and open source project for desktop computers, smartphones, tablets and web browsers which is developed by Belledonne Communications in France. Linphone was the first open source software to use the session initiation protocol (SIP) with VoIP. Using Linphone, we can do voice & video calling, chat, send files, etc.

Linphone Android

I used Linux operating system to start working on Linphone Android. So, I will share all things to start working on Linphone step by step.

1. Install Linux/Ubutu 32 or 64 bit operating system.


Go to Ubuntu site to download: Ubuntu

2. Install Java.


Open “ubuntu software center” and search “java” and than install “Open JDK Java Runtime”.

Install Java

3. Install Eclipse.


Open “ubuntu software center” and search “eclipse” and than install “Eclipse”.

Install Eclipse

4. Download Android SDK.


Go to android developer site: Android SDK and scroll down and then download .tgz extension file.

Download Android SDK

After completing download, right click on file and than press “extract here” option. Now you will get android-sdk-linux folder.

5. Install Android SDK Packages.


Go to android-sdk-linux folder than tools folder than copy the path till tools folder. For example:-

/home/znsoftech/Desktop/android/android-sdk-linux/tools

Now open terminal by using CTRL+ALT+T command or by searching: press super key(window key) than search “terminal” than open it.

Now type on terminal

$ cd /home/znsoftech/Desktop/android/android-sdk-linux/tools

press enter and than type

$ ./android

press enter and than select latest android API, tools and libraries according to your requirement.

Install Android SDK Packages

Click on Install packages than accept License and than install.

6. Download Android NDK.


Go to android developer site: Android NDK and than download android ndk(in .bin format) according to your system(32/64 bit). After completing download, go to download directory(folder) in terminal and than execute following commands:

$ chmod a+x android-ndk-r10c-darwin-x86_64.bin
$ ./android-ndk-r10c-darwin-x86_64.bin

7. Edit .bashrc file


Open new terminal and type

$ ~/.bashrc

than add tools, platform tools, android ndk path and emulator command(If you are using 32 bit operating system) to bashrc file

export PATH=${PATH}:/home/znsoftech/Desktop/android/android-sdk-linux/tools
export PATH=${PATH}:/home/znsoftech/Desktop/android/android-sdk-linux/platform-tools
export PATH=${PATH}:/home/znsoftech/Desktop/android/android-ndk-r10d
export ANDROID_EMULATOR_FORCE_32BIT=true

Edit .bashrc file

Save and close file.

8. Setting up an Android Virtual Device.


Open terminal and type:

$ android avd

hit enter and add a device to launch emulator. Add DNS server setting options, read here: Warning no dns servers found

9. Install ADT plugin on Eclipse.


Open Eclipse than go to Help option and than select “Install new Software...” option. Click on Add button and than type following things:

Name : ADT Plugin
Location : https://dl-ssl.google.com/android/eclipse/

Click on OK button and wait..than select “Developer Tools” check box and than next->next->accept license->OK

After restarting eclipse, add sdk and ndk location in eclipse(Window -> Preferences).

Install ADT plugin on Eclipse.



Till now, all android project environment is set. Now, we need to install sum more libraries for Linphone android project.

10. Install Libraries and Tools for Linphone.


run all commands on terminal one by one.

$ sudo apt-get install yasm
$ sudo apt-get install nasm
$ sudo apt-get install curl
$ sudo apt-get install ant
$ sudo apt-get install rsync

$ sudo apt-get install autoconf
$ sudo apt-get install automake
$ sudo apt-get install aclocal
$ sudo apt-get install libtoolize
$ sudo apt-get install pkgconfig

If your system is 64 bit than excute following command as well:-

$ sudo dpkg --add-architecture i386
$ sudo apt-get install aptitude
$ sudo aptitude update
$ sudo aptitude install libstdc++6:i386 libgcc1:i386 zlib1g:i386 libncurses5:i386

11. Download git repository of Linphone android.


Run the following command to install git and Linphone android project from github site.

$ sudo apt-get install git
$ sudo git clone git://git.linphone.org/linphone-android.git --recursive

12. Run Makefile Script.


Open terminal and go to linphone android directory.

$ cd linphone-android

now run the Makefile script in the top level directory. This will download iLBC source files and convert some assembly files in VP8 project.

$ make

13. Import Linphone Android Project to Eclipse.


Open Eclipse and selcet File -> Import... -> Android -> Existing Android code into Workspace -> Browse... and than select linphone-android folder(Only select linphone-android and don't tick on “copy projects into workspace” ) than OK.

Import Linphone Android Project to Eclipse

61 comments:

  1. Hi. Thanks for your tutorial! I was able to follow up till step 8. When I entered android avd, it says command not found. I did opened up a new terminal... Do I need to cd to anywhere else? Any ideas to resolve this? Please help me! Thanks!!

    ReplyDelete
    Replies
    1. No need to change directory. Check given link on step 8 as well.

      Delete
    2. moshin can we talk i am facing some issue compiling linphone..

      i have installed cmake and ndk-build but it alwas says they are missing waiting for your reply

      Delete
  2. Thanks Moshin well done !
    You set the target build Android 5.1,what will be the minimum SDK?
    The NDK version is revision 10d I used instead 10e and crash at runtime.
    Do you recommend de r10e?

    ReplyDelete
  3. Thanks for your tutorial!
    but i got some problem here.. I can't install aclocal or libtoolize or pkgconfig on ubuntu 14.04.. can you explain how to do that?
    Thanks in advanced!

    ReplyDelete
    Replies
    1. If you are using 32-bit pc than no need to install these packages.

      Delete
    2. thanks for your reply.. and I got another problem here.
      I can't complete step 12. Here's my command line
      --------------------------------------------------------------
      com08@ubuntu:~/linphone-android$ make
      touch: cannot touch ‘check_tools.mk’: Permission denied
      ./check_tools.sh: 45: ./check_tools.sh: cannot create check_tools.mk: Permission denied
      ./check_tools.sh: 46: ./check_tools.sh: cannot create check_tools.mk: Permission denied
      Makefile:80: check_tools.mk: No such file or directory
      make: *** No rule to make target `check_tools.mk'. Stop.
      ------------------------------------------------------------

      and when I run with sudo make
      --------------------------------------------------------------
      com08@ubuntu:~/linphone-android$ sudo make
      Could not find ndk-build. Please install android NDK.
      Could not find android. Please install android SDK.
      Makefile:73: *** commands commence before first target. Stop.
      ------------------------------------------------------------------
      how can i fix that?
      looking forward to hearing from you soon..:)

      Delete
    3. vim check_tools.sh
      then type"set fileformat",check if fileformat=dos,if so,then type "set fileformat=unix",then save and quit

      Delete
    4. hi @Md Mohsin, @Sand Zheng,
      thanks for helping me.
      up to now I can build it and make some files: check_tools.mk, rootca.pem.. but i still got some errors for several days, here they are:
      ------------------------------------------------------------
      jni/..//submodules/linphone/build/android/../../coreapi/bellesip_sal/sal_op_message.c:135: error: undefined reference to 'xmlParseDoc'

      jni/..//submodules/linphone/build/android/../../coreapi/bellesip_sal/sal_op_message.c:291: error: undefined reference to 'xmlParseDoc'
      ...........................
      jni/..//submodules/externals/build/libxml2/../../libxml2/tree.c:396: error: undefined reference to 'xmlStringCurrentChar'

      jni/..//submodules/externals/build/libxml2/../../libxml2/tree.c:400: error: undefined reference to 'xmlStringCurrentChar'
      ...........................
      ------------------------------------------------------------
      Do you have any ideas? I've already installed libxml2.. but i still got that error.. I use ubuntu 14.04 LTS.. Do I need to change or do something with this OS?

      Delete
    5. I found that I don't have xmlParseDoc, xmlReadDoc, xmlReadFile.. where can i get these files? I thought that when I installed the libxml2, these files could be downloaded automatically.. but they didn't.. how do I do it?

      Delete
    6. Châu Vũ I am having the same problem as you had. Whenever i try to make or sudo make it gives the same errors as you mentioned above. Please help me how you solved it

      Delete
    7. you can check my answer here.. :).. http://stackoverflow.com/questions/31151978/linphone-error-when-build-undefined-reference
      -----------------------------
      or you can scroll down and read my comment. :). hope it'll help you..

      Delete
  4. hey Châu Vũ i have the same problem

    Could not find ndk-build. Please install android NDK.
    Could not find android. Please install android SDK.
    Makefile:73: *** commands commence before first target. Stop.

    do you find a solution ?

    ReplyDelete
    Replies
    1. do you export path in bashrc file? if not you can edit it with gedit. Bashrc file in /home/yourUserName/..
      -------------------------------------------------------------
      or you can follow these steps.. I can build linphone by them:
      use ndk r10c
      use source: https://github.com/BelledonneCommunications/linphone-android
      clean project: git clean -xfd
      update submodule: git submodule update --init --recursive
      ndk-build TARGET_PLATFORM=android-x (x is your current API)
      run $make
      ------------------------------------------------------
      you should try the first one.. good luck..:)

      Delete
    2. im really noob to export path tell me if thats right please
      export PATH=${PATH}:/home/hitech/Téléchargements/android-sdk-linux/tools
      export PATH=${PATH}:/home/hitech/Téléchargements/android-sdk-linux/platform-tools
      export PATH=${PATH}:/home/hitech/Téléchargements/android-ndk-r10c

      Delete
    3. for the second i don t know what to do from
      clean project: git clean -xfd
      update submodule: git submodule update --init --recursive
      ndk-build TARGET_PLATFORM=android-x (x is your current API)
      and thank you for help

      Delete
    4. -- Your folder "Téléchargements", I think because of this.. you should not use this, you should put it in a folder like "a" or "b" or just extract sdk and ndk in /home/hitech/yourSDK and the same with NDK.
      -- the commands I gave you, you run in the linphone-android folder. You should use source I gave you because that's the official code. :). They have some update.. If you don't use you may get some errors when build, because of the android M..:).. you can read the update in the second column.

      Delete
    5. thank's for your help it works now you are great guy's
      you reskin the app ?

      Delete
    6. :d.. you're welcome.. I just like to make an app like that..

      Delete
    7. This comment has been removed by the author.

      Delete
    8. The enviroment path is not working with "sudo make" command. You should try:
      $ sudo chmod 777 linphone-adnroid
      $ cd linphone-android
      $ make

      Delete
  5. This comment has been removed by the author.

    ReplyDelete
  6. I am getting this error while running make command. and i cant find any solution.

    BUILD FAILED
    /opt/android-sdk-linux/tools/ant/build.xml:720: The following error occurred while executing this line:
    /opt/android-sdk-linux/tools/ant/build.xml:734: Compile failed; see the compiler error output for details.

    Total time: 6 seconds
    make: *** [javah] Error 1

    ReplyDelete
    Replies
    1. I fixed this issue turns out SDK wasn’t updated to the API 22.
      And i had error after this too but most of the issues came in 64bit Ubuntu I could not find solution for. But the compilation worked in 32bit Ubuntu error free.

      Delete
    2. ndk-build TARGET_PLATFORM=android-x (x is your current API)
      do you try this? run in your linphone-folder

      Delete
  7. I am trying to working with windows OS. Can you guide me how to do that ? I have almost no experience of building or developing application of android ndk. I just print hello world today using ndk.

    ReplyDelete
  8. While executing make from linphone-android, i am getting non_versioned_soname_patch_applied.txt failed.

    But i could not find non_versioned_soname_patch_applied.txt from linphone-android/submodules/externals/ffmpeg/ in the linphone-android source code.

    ReplyDelete
    Replies
    1. sudo git clone git://git.linphone.org/linphone-android.git --recursive

      Delete
  9. Please can you do a similar tutorial but this time for windows based users!!

    ReplyDelete
  10. I managed to fix the sdk location error, but it still persists that my ndk is not installed.. which js and paths set right.. should i install 10c instead of NDK?

    ReplyDelete
    Replies
    1. Never mind, fixed. Refer here if having same issues like me...

      http://stackoverflow.com/questions/33819001/linphone-make-error-could-not-find-ndk-build-could-not-find-android/33838107#33838107

      Delete
  11. when I do a make command, I got an error Missing some git submodules. Did you run 'git submodule update --init --recursive'?

    Please help..:(

    ReplyDelete
    Replies
    1. sudo git clone git://git.linphone.org/linphone-android.git –recursive
      It should be "--recursive", not "-recursive" So just copying the link wont give correct link, change it to --

      Delete
    2. you are correct Sir. This happened due to copy-paste.

      Delete
  12. does linphone compile and build in windows machine...?

    ReplyDelete
  13. This comment has been removed by the author.

    ReplyDelete
  14. Author, your instructions are incomplete. You should ask to read inner README file, as instructions given by you aren't enough. You can remove this comment as well. Or, if you will be kind enough, would you answer my question?
    What can I do if I get:
    CMake Error at toolchains/android/toolchain-android.cmake:76 (message):
    Cannot find libgcc.a
    Thank you a lot.

    ReplyDelete
    Replies
    1. When I was doing this project I have used above instructions. Now there are some changes in new Readme file. This error comes due to c++ compiler but I am not sure.

      Delete
  15. hi. which version of ubuntu did you use?

    ReplyDelete
    Replies
    1. Hi, I wrote this article previous year so I forgot now. May be Ubuntu 14.0

      Delete
  16. (question for mohsin)

    ReplyDelete
  17. i need use this dependence ,but he gives me this error
    Error:A problem occurred configuring root project 'linphone-android'.
    > Could not resolve all dependencies for configuration ':_debugCompile'.
    > Could not find io.socket:socket.io-client:0.7.0.
    Searched in the following locations:
    file:/Applications/Android Studio.app/Contents/gradle/m2repository/io/socket/socket.io-client/0.7.0/socket.io-client-0.7.0.pom
    file:/Applications/Android Studio.app/Contents/gradle/m2repository/io/socket/socket.io-client/0.7.0/socket.io-client-0.7.0.jar
    file:/Users/Angel/Library/Android/sdk/extras/android/m2repository/io/socket/socket.io-client/0.7.0/socket.io-client-0.7.0.pom
    file:/Users/Angel/Library/Android/sdk/extras/android/m2repository/io/socket/socket.io-client/0.7.0/socket.io-client-0.7.0.jar
    file:/Users/Angel/Library/Android/sdk/extras/google/m2repository/io/socket/socket.io-client/0.7.0/socket.io-client-0.7.0.pom
    file:/Users/Angel/Library/Android/sdk/extras/google/m2repository/io/socket/socket.io-client/0.7.0/socket.io-client-0.7.0.jar
    Required by:
    :linphone-android:unspecified

    ReplyDelete
  18. Thanks for the write up, very helpful for a newbie like me...
    Most of this is still valid but anyone having issues should read the README file in linphone-android folder.
    Before step 12 "$ make", the only additional steps needed were:

    $ sudo chown -R $USER ~/linphone-android/
    $ cd ~/linphone-android
    $ ./prepare.py
    $ make

    Linphone compiled successfully using Ubuntu amd64 16.04.1, SDK API 24, NDK r12b.


    ReplyDelete
  19. Hi...
    How can we send Vcard from one chat room to another in linphone android?

    ReplyDelete
  20. Anonymous11:08 am

    Hello,
    I am in desperate need of the linphone android source code. Please if you can send me at chandan.kumar@mobimonster2.com
    THANK YOU!

    ReplyDelete
  21. Hello,

    thanks a lot for your tutoria.

    But yust one question...

    the NDK to use should be android-ndk-r10e-linux-x86_64.zip ?

    why you used MAC version?

    android-ndk-r10c-darwin-x86_64.bin

    Regads

    Mirko

    ReplyDelete
  22. This comment has been removed by the author.

    ReplyDelete
  23. A problem occurred configuring root project 'linphone-android'.
    > Could not resolve all dependencies for configuration ':classpath'.
    > Could not resolve com.android.tools.build:gradle:3.3.
    Required by:
    project :
    > Could not resolve com.android.tools.build:gradle:3.3.
    > java.lang.NoClassDefFoundError: Could not initialize class sun.security.ssl.SSLContextImpl$TLSContext
    > Could not resolve com.android.tools.build:gradle:3.3.
    > java.lang.NoClassDefFoundError: Could not initialize class sun.security.ssl.SSLContextImpl$TLSContext

    ReplyDelete
  24. [ 1%] Building C object library/CMakeFiles/mbedcrypto.dir/aes.c.o
    /bin/sh: 1: ccache: not found
    library/CMakeFiles/mbedcrypto.dir/build.make:62: recipe for target 'library/CMakeFiles/mbedcrypto.dir/aes.c.o' failed
    make[6]: *** [library/CMakeFiles/mbedcrypto.dir/aes.c.o] Error 127
    make[6]: Leaving directory '/media/asus/WORK/Linux/linphone-android/WORK/android-arm64/Build/mbedtls'
    CMakeFiles/Makefile2:122: recipe for target 'library/CMakeFiles/mbedcrypto.dir/all' failed
    make[5]: *** [library/CMakeFiles/mbedcrypto.dir/all] Error 2
    make[5]: Leaving directory '/media/asus/WORK/Linux/linphone-android/WORK/android-arm64/Build/mbedtls'
    Makefile:129: recipe for target 'all' failed
    make[4]: *** [all] Error 2
    make[4]: Leaving directory '/media/asus/WORK/Linux/linphone-android/WORK/android-arm64/Build/mbedtls'
    CMakeFiles/EP_mbedtls.dir/build.make:112: recipe for target '/media/asus/WORK/Linux/linphone-android/WORK/android-arm64/Stamp/EP_mbedtls/EP_mbedtls-build' failed
    make[3]: *** [/media/asus/WORK/Linux/linphone-android/WORK/android-arm64/Stamp/EP_mbedtls/EP_mbedtls-build] Error 2
    make[3]: Leaving directory '/media/asus/WORK/Linux/linphone-android/WORK/android-arm64/cmake'
    CMakeFiles/Makefile2:641: recipe for target 'CMakeFiles/EP_mbedtls.dir/all' failed
    make[2]: *** [CMakeFiles/EP_mbedtls.dir/all] Error 2
    make[2]: Leaving directory '/media/asus/WORK/Linux/linphone-android/WORK/android-arm64/cmake'
    Makefile:83: recipe for target 'all' failed
    make[1]: *** [all] Error 2
    make[1]: Leaving directory '/media/asus/WORK/Linux/linphone-android/WORK/android-arm64/cmake'
    Makefile:176: recipe for target 'arm64-build' failed
    make: *** [arm64-build] Error 2

    getting this error kindly help to fix this ?

    ReplyDelete
  25. i got following problem
    * What went wrong:
    A problem occurred evaluating root project 'linphone-android'.
    > A problem occurred starting process 'command '/home/kashif/Android/Sdk/platform-tools/adb''

    ReplyDelete
  26. Hi!
    i run the linphone sample project but i don't know how i can register with them... how the calling works... could you please help?

    ReplyDelete
  27. Anonymous5:35 pm

    Hi..
    I am using the linphone jar file for making audio as well as Video call.

    Audio call is working fine but when i try to make video call using the linphone jar, is not supporting..

    The api linphonecore.isVideosupported() is always returning false.

    Can any one please help me..

    ReplyDelete
    Replies
    1. Please it is the Liblinphone lib? I am really struggling to even logging to my sip server can you help share registration code removing any sensitive data

      Delete
  28. I have imported linphone-android as Android studio project after make.

    when I am launching application my application stops before any screen appears. when I debug I saw that application crashes on this line inside LinphoneMangaer.java file: mLc = Factory.instance().createCore(mConfigFile, mLinphoneFactoryConfigFile, c);

    ReplyDelete
  29. if you upload the build version of this, it will help us, cause the steps are just too complex...please upload the built version, and will can run it on our devices thanks

    ReplyDelete
  30. try to run the $make but get this error:
    make: *** No rule to make target 'clean'. Stop.
    how can i solve that problem?

    ReplyDelete
  31. is it work on windows10

    ReplyDelete
  32. i hav linphone android open source code i need to connect app calls to my own sip address ,.. please anyone help

    ReplyDelete

Back to Top