linphone-xamarin
linphone-xamarin copied to clipboard
Calling ms_get_jni_env() while no jvm has been set using ms_set_jvm
Hi,
I am trying to use linphone-xamarin in a Xamarin Forms project. Everything compiles fine but when I launch the application I get this error and it just crashes :
Calling ms_get_jni_env() while no jvm has been set using ms_set_jvm
It crashes in this line :
Core = Factory.Instance.CreateCore(configPath, factoryPath, context);
I have 3 projects in my solution :
- Liblinphone
- Test
- Test.Android
Liblinphone and Test.Android are targeting Android 9.0 Oreo Test and Test.Android are targeting Xamarin Forms 4.5
I have used linphone-sdk-xamarin-4.3.4.zip from https://www.linphone.org/releases/xamarin/ and I have replaced both liblinphone-sdk.aar and LinphoneWrapper.cs
I am using Visual Studio 2019.
Please help, I am completely stuck. I even tried to compile and run the sample provided in the documentation (TutoXamarin) and I have the same error.
Hello...I managed to solve it for me....according to BC from SDK 4.4.0 alpha manually loading native libraries is performed in Factory but this error means that somehow is not happening even though I'm using 4.5.0.
Solution was to mannualy load libraries again by putting this lines in the OnCreate method in MainActivity.cs
Java.Lang.JavaSystem.LoadLibrary("c++_shared"); Java.Lang.JavaSystem.LoadLibrary("bctoolbox"); Java.Lang.JavaSystem.LoadLibrary("ortp"); Java.Lang.JavaSystem.LoadLibrary("mediastreamer"); Java.Lang.JavaSystem.LoadLibrary("linphone");
check this link for more info https://gitlab.linphone.org/BC/public/linphone-xamarin/issues/1
I had the same problem, I fixed it, by switching the version of the LinphoneWrapper.cs. I had the problem with SDK 4.3.4 and the SDK 4.3.5, but with the SDK 4.4.20 (downloadlink: http://linphone.org/snapshots/xamarin/linphone-sdk-xamarin-4.4.20.zip and here are the nightly builds http://linphone.org/snapshots/xamarin/) it worked without manualy load the librraries in MainActivity,cs
See the commit from BC, check this link(https://gitlab.linphone.org/BC/public/linphone-xamarin/commit/245e62f68bbb57dd8a46f303ca04e5b998ec976d);