0

I have created an Android Application in that I want to make voice and video call using "Linphone" library.

I successfully download and setup the library project but when I run project get the below error in "LinphoneService.java" file.

I get error in this lines:

LinphoneCoreFactory.instance().setLogCollectionPath(
            getFilesDir().getAbsolutePath());
LinphoneCoreFactory.instance().enableLogCollection(
            !(getResources().getBoolean(R.bool.disable_every_log)));

Exception:

03-07 17:35:41.400: D/AndroidRuntime(8217): Shutting down VM
03-07 17:35:41.400: W/dalvikvm(8217): threadid=1: thread exiting with uncaught exception (group=0x417e4da0)
03-07 17:35:41.400: E/AndroidRuntime(8217): FATAL EXCEPTION: main
03-07 17:35:41.400: E/AndroidRuntime(8217): Process: org.linphone, PID: 8217
03-07 17:35:41.400: E/AndroidRuntime(8217): java.lang.RuntimeException: Unable to create service org.linphone.LinphoneService: java.lang.NullPointerException
03-07 17:35:41.400: E/AndroidRuntime(8217):     at android.app.ActivityThread.handleCreateService(ActivityThread.java:2824)
03-07 17:35:41.400: E/AndroidRuntime(8217):     at android.app.ActivityThread.access$1900(ActivityThread.java:172)
03-07 17:35:41.400: E/AndroidRuntime(8217):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1390)
03-07 17:35:41.400: E/AndroidRuntime(8217):     at android.os.Handler.dispatchMessage(Handler.java:102)
03-07 17:35:41.400: E/AndroidRuntime(8217):     at android.os.Looper.loop(Looper.java:146)
03-07 17:35:41.400: E/AndroidRuntime(8217):     at android.app.ActivityThread.main(ActivityThread.java:5653)
03-07 17:35:41.400: E/AndroidRuntime(8217):     at java.lang.reflect.Method.invokeNative(Native Method)
03-07 17:35:41.400: E/AndroidRuntime(8217):     at java.lang.reflect.Method.invoke(Method.java:515)
03-07 17:35:41.400: E/AndroidRuntime(8217):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1291)
03-07 17:35:41.400: E/AndroidRuntime(8217):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1107)
03-07 17:35:41.400: E/AndroidRuntime(8217):     at dalvik.system.NativeStart.main(Native Method)
03-07 17:35:41.400: E/AndroidRuntime(8217): Caused by: java.lang.NullPointerException
03-07 17:35:41.400: E/AndroidRuntime(8217):     at org.linphone.LinphoneService.onCreate(LinphoneService.java:140)
03-07 17:35:41.400: E/AndroidRuntime(8217):     at android.app.ActivityThread.handleCreateService(ActivityThread.java:2814)
03-07 17:35:41.400: E/AndroidRuntime(8217):     ... 10 more
Cœur
  • 37,241
  • 25
  • 195
  • 267
John SMITH
  • 111
  • 2
  • 11

2 Answers2

2

I had the same problem, to fix this your libs folder must be located inside app/src/main. Also if you are working with Android Studio, your libs folder must be called jniLibs.

Hope this helps.

Isaac
  • 1,436
  • 2
  • 15
  • 29
  • Can you provide me more details as I am getting this error with android studio. – Md Mohsin Jan 25 '17 at 18:24
  • Sorry, I don't know what you mean. I'm not longer working with that, but as far as I remember, all you have to do is place your linphone libs files in the folders that I mention. – Isaac Feb 02 '17 at 12:57
0

Try changing:

public static final synchronized LinphoneCoreFactory instance() {

    try {

        if (theLinphoneCoreFactory == null) {

            Class lFactoryClass = Class.forName(factoryName);

            theLinphoneCoreFactory = (LinphoneCoreFactory) lFactoryClass.newInstance();

        }

    } catch (Exception e) {

        System.err.println("Cannot instanciate factory ["+factoryName+"]");

    }

    return theLinphoneCoreFactory;

}

To:

public static final synchronized LinphoneCoreFactory instance() {

    try {

        if (theLinphoneCoreFactory == null) {

            theLinphoneCoreFactory = new LinphoneCoreFactoryImpl();

        }

    } catch (Exception e) {

        System.err.println("Cannot instanciate factory ["+factoryName+"]");

    }

    return theLinphoneCoreFactory;

}

Use: link to import native libraries. Copy all of the directory's and files from this file into the project's /libs/

Community
  • 1
  • 1
TameHog
  • 950
  • 11
  • 23
  • It gives this error: at org.linphone.LinphoneService.onCreate(LinphoneService.java:141) 03-07 18:17:58.788: E/AndroidRuntime(17765): at android.app.ActivityThread.handleCreateService(ActivityThread.java:2814) 03-07 18:17:58.788: E/AndroidRuntime(17765): at android.app.ActivityThread.access$1900(ActivityThread.java:172) 03-07 18:17:58.788: E/AndroidRuntime(17765): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1390) 03-07 18:17:58.788: E/AndroidRuntime(17765): – John SMITH Mar 07 '15 at 12:51
  • What's the exception? – TameHog Mar 07 '15 at 12:52
  • 03-07 18:17:58.788: E/AndroidRuntime(17765): java.lang.UnsatisfiedLinkError: Couldn't load linphone-armeabi-v7a from loader dalvik.system.PathClassLoader[dexPath=/data/app/org.linphone-6.apk,libraryPath=/data/app-lib/org.linphone-6]: findLibrary returned null – John SMITH Mar 07 '15 at 12:53
  • That's me and the shared library isn't there. Did you include the natives? – TameHog Mar 07 '15 at 12:54
  • I added all the libraries, which one is missing? – John SMITH Mar 07 '15 at 12:55
  • Updated answer check it out – TameHog Mar 07 '15 at 14:58