Hello,
I am creating a B4A library to interface with Microsoft Cognitive Services (MCS) speech recognition.
MCS requires the inclusion of a .so library file, libandroid_platform.so.
I have the library file. How do I include it in the B4A library project?
I'm still using Eclipse and I am using the Simple Library Compiler (SLC).
On the SLC tutorial webpage I see the following:
- If you need to include any additional files, such as .so files, in the jar then you can create a folder named 'additional'. Any file or folder inside this folder will be added to the jar file.
I'm not 100% sure where to add the "additional" directory, but I added the directory to my Eclipse project directly beneath the Project directory (the "additional" directory is at the same level as the src and lib directories).
If I open the .jar file with WinZip I see that the .so library has been added.
The problem is when I run my B4A program that accesses the library, I can access methods I have created that return strings and debug messages via raiseevents – so I am fairly confident the library is doing something. But, as soon as I access a method that invokes a routine in my library via B4A code that's part of Microsoft Cognitive Services I get an " Unfortunately your app has stopped…" Crash message on my phone.
The error message in the B4A IDE:
It seems like it's not finding the libandroid_platform.so file. How should I include this file into Eclipse so that Simple Library Compiler will include it in my jar file?
Thanks,
Barry.
I am creating a B4A library to interface with Microsoft Cognitive Services (MCS) speech recognition.
MCS requires the inclusion of a .so library file, libandroid_platform.so.
I have the library file. How do I include it in the B4A library project?
I'm still using Eclipse and I am using the Simple Library Compiler (SLC).
On the SLC tutorial webpage I see the following:
- If you need to include any additional files, such as .so files, in the jar then you can create a folder named 'additional'. Any file or folder inside this folder will be added to the jar file.
I'm not 100% sure where to add the "additional" directory, but I added the directory to my Eclipse project directly beneath the Project directory (the "additional" directory is at the same level as the src and lib directories).
If I open the .jar file with WinZip I see that the .so library has been added.
The problem is when I run my B4A program that accesses the library, I can access methods I have created that return strings and debug messages via raiseevents – so I am fairly confident the library is doing something. But, as soon as I access a method that invokes a routine in my library via B4A code that's part of Microsoft Cognitive Services I get an " Unfortunately your app has stopped…" Crash message on my phone.
The error message in the B4A IDE:
B4X:
java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/b4a.example-2/base.apk"],nativeLibraryDirectories=[/vendor/lib, /system/lib]]] couldn't find "libandroid_platform.so"
at java.lang.Runtime.loadLibrary(Runtime.java:366)
at java.lang.System.loadLibrary(System.java:989)
at com.microsoft.bing.speech.Conversation.<clinit>(Conversation.java:68)
at com.microsoft.cognitiveservices.speechrecognition.SpeechRecognitionServiceFactory.createMicrophoneClient(SpeechRecognitionServiceFactory.java:747)
at canalrun.com.crbvr.CRBingVR.StartVR(CRBingVR.java:63)
at b4a.example.main._bnstart_click(main.java:414)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:187)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:175)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:171)
at anywheresoftware.b4a.objects.ViewWrapper$1.onClick(ViewWrapper.java:77)
at android.view.View.performClick(View.java:4764)
at android.view.View$PerformClick.run(View.java:19844)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5349)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:908)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:703)
It seems like it's not finding the libandroid_platform.so file. How should I include this file into Eclipse so that Simple Library Compiler will include it in my jar file?
Thanks,
Barry.