Linphone for android is not working/missing libraries

Prakash picture Prakash · Feb 26, 2013 · Viewed 9.6k times · Source

I am trying to run linphone code which I get from git://git.linphone.org/linphone-android.git --recursive . After downloading it successfully, I tried to compile and run it as per the README file. I used Cygwin for Autotools, Autoconfig, Automake, aclocal, libtoolize and pkgconfig & Android ndk r8d.

then I executed the prepare_sources.sh shell script in cygwin which downloaded some needed resuorces.

After following all the steps, when I tried to run the code I get an UnsatisfiedLinkError exception on runtime and application crashes.

I also get to know from logcat that some libraries are unable to load due to which the above exception took place and crashed the app. Here is the Logcat output :

02-26 10:03:55.739: W/Unable to load optional library lib(1084): avutil
02-26 10:03:55.749: W/Unable to load optional library lib(1084): swscale
02-26 10:03:55.759: W/Unable to load optional library lib(1084): avcore
02-26 10:03:55.769: W/dalvikvm(1084): Exception Ljava/lang/UnsatisfiedLinkError; thrown while initializing Lorg/linphone/core/LinphoneCoreFactoryImpl;
02-26 10:03:55.769: D/AndroidRuntime(1084): Shutting down VM

==================================================================================

02-26 10:03:55.769: W/dalvikvm(1084): threadid=1: thread exiting with uncaught exception (group=0x40a70930)
02-26 10:03:55.869: E/AndroidRuntime(1084): FATAL EXCEPTION: main
02-26 10:03:55.869: E/AndroidRuntime(1084): java.lang.ExceptionInInitializerError
02-26 10:03:55.869: E/AndroidRuntime(1084):     at java.lang.Class.classForName(Native Method)
02-26 10:03:55.869: E/AndroidRuntime(1084):     at java.lang.Class.forName(Class.java:217)
02-26 10:03:55.869: E/AndroidRuntime(1084):     at java.lang.Class.forName(Class.java:172)
02-26 10:03:55.869: E/AndroidRuntime(1084):     at org.linphone.core.LinphoneCoreFactory.instance(LinphoneCoreFactory.java:43)
02-26 10:03:55.869: E/AndroidRuntime(1084):     at org.linphone.LinphoneManager.startLibLinphone(LinphoneManager.java:417)
02-26 10:03:55.869: E/AndroidRuntime(1084):     at org.linphone.LinphoneManager.createAndStart(LinphoneManager.java:226)
02-26 10:03:55.869: E/AndroidRuntime(1084):     at org.linphone.LinphoneService.onCreate(LinphoneService.java:165)
02-26 10:03:55.869: E/AndroidRuntime(1084):     at android.app.ActivityThread.handleCreateService(ActivityThread.java:2529)
02-26 10:03:55.869: E/AndroidRuntime(1084):     at android.app.ActivityThread.access$1600(ActivityThread.java:141)
02-26 10:03:55.869: E/AndroidRuntime(1084):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1316)
02-26 10:03:55.869: E/AndroidRuntime(1084):     at android.os.Handler.dispatchMessage(Handler.java:99)
02-26 10:03:55.869: E/AndroidRuntime(1084):     at android.os.Looper.loop(Looper.java:137)
02-26 10:03:55.869: E/AndroidRuntime(1084):     at android.app.ActivityThread.main(ActivityThread.java:5039)
02-26 10:03:55.869: E/AndroidRuntime(1084):     at java.lang.reflect.Method.invokeNative(Native Method)
02-26 10:03:55.869: E/AndroidRuntime(1084):     at java.lang.reflect.Method.invoke(Method.java:511)
02-26 10:03:55.869: E/AndroidRuntime(1084):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
02-26 10:03:55.869: E/AndroidRuntime(1084):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
02-26 10:03:55.869: E/AndroidRuntime(1084):     at dalvik.system.NativeStart.main(Native Method)
02-26 10:03:55.869: E/AndroidRuntime(1084): Caused by: java.lang.UnsatisfiedLinkError: Couldn't load neon from loader dalvik.system.PathClassLoader[dexPath=/data/app/org.linphone-1.apk,libraryPath=/data/app-lib/org.linphone-1]: findLibrary returned null
02-26 10:03:55.869: E/AndroidRuntime(1084):     at java.lang.Runtime.loadLibrary(Runtime.java:365)
02-26 10:03:55.869: E/AndroidRuntime(1084):     at java.lang.System.loadLibrary(System.java:535)
02-26 10:03:55.869: E/AndroidRuntime(1084):     at org.linphone.core.LinphoneCoreFactoryImpl.<clinit>(LinphoneCoreFactoryImpl.java:47)
02-26 10:03:55.869: E/AndroidRuntime(1084):     ... 18 more

Can anybody help me to get it solved.? A solution for this, is greatly appreciated.. Thanks in advance.

Answer

iPhnQ picture iPhnQ · Sep 18, 2013

Part 1

The following steps can help you create and install the build on your device or emulator(Tested on Mac):

Step1: you need to have the Android SDK and NDK configured and istalled Also install Autotools Mac users can use this link (Follow point 2.3 only in the link) Other platform users please make sure you install it correctly.

Step2: Mac users open up your terminal and clone the git repo on any directory you want to by running the following command: (Other users sorry i don't know how but i think you can figure it out that how you can get the git repo on your directory using command promt or whatever you are using)

$ git clone git://git.linphone.org/linphone-android.git --recursive

After you get the Repo copied into your directory now go to the directory and open the README file and read out the whole file.

Step3: Now we will follow as the instructions written in README file First Go to root directory of the downloaded project using the following command on Terminal:

Mac users on terminal write cd and 
then drag and drop the "linphone-android" folder on terminal 
(when you drag and drop the folder terminal will get the path of the folder and then you can hit enter to get into the directory of that folder) 

$ cd /Users/myname/Desktop/Android/linphone-android

or just use simple command cd to get into the folder

   $ cd Desktop
   $ cd Android
   $ cd linphone-android

Now when you get into the directory on terminal then check your PATH of SDK & NDK installed on your Mac run

$ echo $PATH

if you see the path with SDK and NDK location then it's ok to proceed with Step4 and skip the below part and if not then you need to setup the PATH before you execute the make and make install script in Step 4: To set up path use :

$ export PATH=/Users/myname/Documents/adt-bundle-mac-x86_64-20130729/sdk/platform-tools:/Users/myname/Documents/adt-bundle-mac-x86_64-20130729/sdk/tools:/Users/myname/Documents/android-ndk-r9:$PATH 

it's like export PATH=(Path of your SDK platform tools folder):(Path of your SDK tools folder):(Path of your NDK folder):$PATH

This will set up the path and to confirm again run

$ echo $PATH

Now you will see that the path of SDK and NDK is there.

Step 4: Now if the Path is already setup you can simply run

$ make

Now connect your Device to you Mac/Pc and see if eclipse has detected it. After the device is connected run:

$ make install

$ make generate-sdk (optional)

This will install the application into your phone. (you need to have an working SIP username and password to configure in the app)

This above steps worked for me and i was able to get the app running on my device.

Part 2

Importing into Eclipse : After you have made your build then now you need to import it into eclipse.

Step1: Go to eclipse click on File Menu then Import then select Existing Android Code into Workspace

Hit Next and Browse to the linphone-android project folder And Only tick linphone-android folder and Leave Copy project into workspace untick.

Do it Like the below image: enter image description here

And hit finish. Now you right click on "linphone-android" (project name) and go to Properties and Java Build Path and then Order and Export and then reorder them as my image below and untick gcm.jar

enter image description here

Hit OK And Boom No errors Now just run it on device or emulator. (Make sure your minimum target SDK matches with your device or emulator.)

The above steps worked fine for me and it will work for you as well.

All the Best !!