question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Runtime error when including vosk AAR

See original GitHub issue

Hi
I have slightly modified the vosk library and I need to include the built AAR in to my project. I have copied the file to my lib folder and it my project compiles fine but I am getting this runtime error

Here is the command I used to build it: ./gradlew build

Then I copied this to my project vosk-api/android/lib/build/outputs/aar/vosk-android-release.aar

Here is the runtime error. Many thanks


(standard input):906:May 18 09:55:48 05-18 09:55:48.570 11584 11584 D app.testdirect.testdirecthub2.MainActivitytest Voice vosk kaldi: getting model
(standard input)-907-May 18 09:55:48 05-18 09:55:48.591 11584 11584 D AndroidRuntime: Shutting down VM
(standard input)-908-May 18 09:55:48 --------- beginning of crash
(standard input)-909-May 18 09:55:48 05-18 09:55:48.595 11584 11584 E AndroidRuntime: FATAL EXCEPTION: main
(standard input):910:May 18 09:55:48 05-18 09:55:48.595 11584 11584 E AndroidRuntime: Process: app.testdirect.testdirecthub2, PID: 11584
(standard input):911:May 18 09:55:48 05-18 09:55:48.595 11584 11584 E AndroidRuntime: java.lang.UnsatisfiedLinkError: Unable to load library 'vosk':
(standard input):912:May 18 09:55:48 05-18 09:55:48.595 11584 11584 E AndroidRuntime: dlopen failed: library "libvosk.so" not found
(standard input):913:May 18 09:55:48 05-18 09:55:48.595 11584 11584 E AndroidRuntime: dlopen failed: library "libvosk.so" not found
(standard input):914:May 18 09:55:48 05-18 09:55:48.595 11584 11584 E AndroidRuntime: dalvik.system.PathClassLoader[DexPathList[[zip file "/system/framework/org.apache.http.legacy.boot.jar", zip file "/data/app/app.testdirect.testdirecthub2-6SeUXkg6AM-7ZIPFzVOU1A==/base.apk"],nativeLibraryDirectories=[/data/app/app.testdirect.testdirecthub2-6SeUXkg6AM-7ZIPFzVOU1A==/lib/x86, /data/app/app.testdirect.testdirecthub2-6SeUXkg6AM-7ZIPFzVOU1A==/base.apk!/lib/x86, /system/lib]]] couldn't find "libvosk.so"
(standard input):915:May 18 09:55:48 05-18 09:55:48.595 11584 11584 E AndroidRuntime: Native library (android-x86/libvosk.so) not found in resource path (.)
(standard input)-916-May 18 09:55:48 05-18 09:55:48.595 11584 11584 E AndroidRuntime:   at com.sun.jna.NativeLibrary.loadLibrary(NativeLibrary.java:301)
(standard input)-917-May 18 09:55:48 05-18 09:55:48.595 11584 11584 E AndroidRuntime:   at com.sun.jna.NativeLibrary.getInstance(NativeLibrary.java:461)
(standard input)-918-May 18 09:55:48 05-18 09:55:48.595 11584 11584 E AndroidRuntime:   at com.sun.jna.Native.register(Native.java:1746)
(standard input):919:May 18 09:55:48 05-18 09:55:48.595 11584 11584 E AndroidRuntime:   at org.vosk.LibVosk.<clinit>(LibVosk.java:9)
(standard input):920:May 18 09:55:48 05-18 09:55:48.595 11584 11584 E AndroidRuntime:   at org.vosk.LibVosk.vosk_model_new(Native Method)
(standard input):921:May 18 09:55:48 05-18 09:55:48.595 11584 11584 E AndroidRuntime:   at org.vosk.Model.<init>(Model.java:10)
(standard input):922:May 18 09:55:48 05-18 09:55:48.595 11584 11584 E AndroidRuntime:   at app.testdirect.testdirecthub2.voice.MyVoiceModule$2.run(MyVoiceModule.java:150)
(standard input)-923-May 18 09:55:48 05-18 09:55:48.595 11584 11584 E AndroidRuntime:   at android.os.Handler.handleCallback(Handler.java:873)
(standard input)-924-May 18 09:55:48 05-18 09:55:48.595 11584 11584 E AndroidRuntime:   at android.os.Handler.dispatchMessage(Handler.java:99)
(standard input)-925-May 18 09:55:48 05-18 09:55:48.595 11584 11584 E AndroidRuntime:   at android.os.Looper.loop(Looper.java:193)
(standard input)-926-May 18 09:55:48 05-18 09:55:48.595 11584 11584 E AndroidRuntime:   at android.app.ActivityThread.main(ActivityThread.java:6669)
(standard input)-927-May 18 09:55:48 05-18 09:55:48.595 11584 11584 E AndroidRuntime:   at java.lang.reflect.Method.invoke(Native Method)
(standard input)-928-May 18 09:55:48 05-18 09:55:48.595 11584 11584 E AndroidRuntime:   at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
(standard input)-929-May 18 09:55:48 05-18 09:55:48.595 11584 11584 E AndroidRuntime:   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
(standard input):930:May 18 09:55:48 05-18 09:55:48.595 11584 11584 E AndroidRuntime:   Suppressed: java.lang.UnsatisfiedLinkError: dlopen failed: library "libvosk.so" not found
(standard input)-931-May 18 09:55:48 05-18 09:55:48.595 11584 11584 E AndroidRuntime:           at com.sun.jna.Native.open(Native Method)
(standard input)-932-May 18 09:55:48 05-18 09:55:48.595 11584 11584 E AndroidRuntime:           at com.sun.jna.NativeLibrary.loadLibrary(NativeLibrary.java:191)
(standard input)-933-May 18 09:55:48 05-18 09:55:48.595 11584 11584 E AndroidRuntime:           ... 13 more
(standard input):934:May 18 09:55:48 05-18 09:55:48.595 11584 11584 E AndroidRuntime:   Suppressed: java.lang.UnsatisfiedLinkError: dlopen failed: library "libvosk.so" not found
(standard input)-935-May 18 09:55:48 05-18 09:55:48.595 11584 11584 E AndroidRuntime:           at com.sun.jna.Native.open(Native Method)
(standard input)-936-May 18 09:55:48 05-18 09:55:48.595 11584 11584 E AndroidRuntime:           at com.sun.jna.NativeLibrary.loadLibrary(NativeLibrary.java:204)
(standard input)-937-May 18 09:55:48 05-18 09:55:48.595 11584 11584 E AndroidRuntime:           ... 13 more
(standard input):938:May 18 09:55:48 05-18 09:55:48.595 11584 11584 E AndroidRuntime:   Suppressed: java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/system/framework/org.apache.http.legacy.boot.jar", zip file "/data/app/app.testdirect.testdirecthub2-6SeUXkg6AM-7ZIPFzVOU1A==/base.apk"],nativeLibraryDirectories=[/data/app/app.testdirect.testdirecthub2-6SeUXkg6AM-7ZIPFzVOU1A==/lib/x86, /data/app/app.testdirect.testdirecthub2-6SeUXkg6AM-7ZIPFzVOU1A==/base.apk!/lib/x86, /system/lib]]] couldn't find "libvosk.so"
(standard input)-939-May 18 09:55:48 05-18 09:55:48.595 11584 11584 E AndroidRuntime:           at java.lang.Runtime.loadLibrary0(Runtime.java:1012)
(standard input)-940-May 18 09:55:48 05-18 09:55:48.595 11584 11584 E AndroidRuntime:           at java.lang.System.loadLibrary(System.java:1669)
(standard input)-941-May 18 09:55:48 05-18 09:55:48.595 11584 11584 E AndroidRuntime:           at com.sun.jna.NativeLibrary.loadLibrary(NativeLibrary.java:218)
(standard input)-942-May 18 09:55:48 05-18 09:55:48.595 11584 11584 E AndroidRuntime:           ... 13 more
(standard input):943:May 18 09:55:48 05-18 09:55:48.595 11584 11584 E AndroidRuntime:   Suppressed: java.io.IOException: Native library (android-x86/libvosk.so) not found in resource path (.)
(standard input)-944-May 18 09:55:48 05-18 09:55:48.595 11584 11584 E AndroidRuntime:           at com.sun.jna.Native.extractFromResourcePath(Native.java:1119)
(standard input)-945-May 18 09:55:48 05-18 09:55:48.595 11584 11584 E AndroidRuntime:           at com.sun.jna.NativeLibrary.loadLibrary(NativeLibrary.java:275)
(standard input)-946-May 18 09:55:48 05-18 09:55:48.595 11584 11584 E AndroidRuntime:           ... 13 more
(standard input):947:May 18 09:55:48 05-18 09:55:48.597 11584 11584 E ACRA    : ACRA caught a UnsatisfiedLinkError for app.testdirect.testdirecthub2
(standard input):948:May 18 09:55:48 05-18 09:55:48.597 11584 11584 E ACRA    : java.lang.UnsatisfiedLinkError: Unable to load library 'vosk':
(standard input):949:May 18 09:55:48 05-18 09:55:48.597 11584 11584 E ACRA    : dlopen failed: library "libvosk.so" not found
(standard input):950:May 18 09:55:48 05-18 09:55:48.597 11584 11584 E ACRA    : dlopen failed: library "libvosk.so" not found
(standard input):951:May 18 09:55:48 05-18 09:55:48.597 11584 11584 E ACRA    : dalvik.system.PathClassLoader[DexPathList[[zip file "/system/framework/org.apache.http.legacy.boot.jar", zip file "/data/app/app.testdirect.testdirecthub2-6SeUXkg6AM-7ZIPFzVOU1A==/base.apk"],nativeLibraryDirectories=[/data/app/app.testdirect.testdirecthub2-6SeUXkg6AM-7ZIPFzVOU1A==/lib/x86, /data/app/app.testdirect.testdirecthub2-6SeUXkg6AM-7ZIPFzVOU1A==/base.apk!/lib/x86, /system/lib]]] couldn't find "libvosk.so"
(standard input):952:May 18 09:55:48 05-18 09:55:48.597 11584 11584 E ACRA    : Native library (android-x86/libvosk.so) not found in resource path (.)
(standard input)-953-May 18 09:55:48 05-18 09:55:48.597 11584 11584 E ACRA    :         at com.sun.jna.NativeLibrary.loadLibrary(NativeLibrary.java:301)
(standard input)-954-May 18 09:55:48 05-18 09:55:48.597 11584 11584 E ACRA    :         at com.sun.jna.NativeLibrary.getInstance(NativeLibrary.java:461)
(standard input)-955-May 18 09:55:48 05-18 09:55:48.597 11584 11584 E ACRA    :         at com.sun.jna.Native.register(Native.java:1746)
(standard input):956:May 18 09:55:48 05-18 09:55:48.597 11584 11584 E ACRA    :         at org.vosk.LibVosk.<clinit>(LibVosk.java:9)
(standard input):957:May 18 09:55:48 05-18 09:55:48.597 11584 11584 E ACRA    :         at org.vosk.LibVosk.vosk_model_new(Native Method)
(standard input):958:May 18 09:55:48 05-18 09:55:48.597 11584 11584 E ACRA    :         at org.vosk.Model.<init>(Model.java:10)
(standard input):959:May 18 09:55:48 05-18 09:55:48.597 11584 11584 E ACRA    :         at app.testdirect.testdirecthub2.voice.MyVoiceModule$2.run(MyVoiceModule.java:150)
(standard input)-960-May 18 09:55:48 05-18 09:55:48.597 11584 11584 E ACRA    :         at android.os.Handler.handleCallback(Handler.java:873)
(standard input)-961-May 18 09:55:48 05-18 09:55:48.597 11584 11584 E ACRA    :         at android.os.Handler.dispatchMessage(Handler.java:99)
(standard input)-962-May 18 09:55:48 05-18 09:55:48.597 11584 11584 E ACRA    :         at android.os.Looper.loop(Looper.java:193)
(standard input)-963-May 18 09:55:48 05-18 09:55:48.597 11584 11584 E ACRA    :         at android.app.ActivityThread.main(ActivityThread.java:6669)
(standard input)-964-May 18 09:55:48 05-18 09:55:48.597 11584 11584 E ACRA    :         at java.lang.reflect.Method.invoke(Native Method)
(standard input)-965-May 18 09:55:48 05-18 09:55:48.597 11584 11584 E ACRA    :         at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
(standard input)-966-May 18 09:55:48 05-18 09:55:48.597 11584 11584 E ACRA    :         at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
(standard input):967:May 18 09:55:48 05-18 09:55:48.597 11584 11584 E ACRA    :         Suppressed: java.lang.UnsatisfiedLinkError: dlopen failed: library "libvosk.so" not found
(standard input)-968-May 18 09:55:48 05-18 09:55:48.597 11584 11584 E ACRA    :                 at com.sun.jna.Native.open(Native Method)
(standard input)-969-May 18 09:55:48 05-18 09:55:48.597 11584 11584 E ACRA    :                 at com.sun.jna.NativeLibrary.loadLibrary(NativeLibrary.java:191)
(standard input)-970-May 18 09:55:48 05-18 09:55:48.597 11584 11584 E ACRA    :                 ... 13 more
(standard input):971:May 18 09:55:48 05-18 09:55:48.597 11584 11584 E ACRA    :         Suppressed: java.lang.UnsatisfiedLinkError: dlopen failed: library "libvosk.so" not found
(standard input)-972-May 18 09:55:48 05-18 09:55:48.597 11584 11584 E ACRA    :                 at com.sun.jna.Native.open(Native Method)
(standard input)-973-May 18 09:55:48 05-18 09:55:48.597 11584 11584 E ACRA    :                 at com.sun.jna.NativeLibrary.loadLibrary(NativeLibrary.java:204)
(standard input)-974-May 18 09:55:48 05-18 09:55:48.597 11584 11584 E ACRA    :                 ... 13 more
(standard input):975:May 18 09:55:48 05-18 09:55:48.597 11584 11584 E ACRA    :         Suppressed: java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/system/framework/org.apache.http.legacy.boot.jar", zip file "/data/app/app.testdirect.testdirecthub2-6SeUXkg6AM-7ZIPFzVOU1A==/base.apk"],nativeLibraryDirectories=[/data/app/app.testdirect.testdirecthub2-6SeUXkg6AM-7ZIPFzVOU1A==/lib/x86, /data/app/app.testdirect.testdirecthub2-6SeUXkg6AM-7ZIPFzVOU1A==/base.apk!/lib/x86, /system/lib]]] couldn't find "libvosk.so"
(standard input)-976-May 18 09:55:48 05-18 09:55:48.597 11584 11584 E ACRA    :                 at java.lang.Runtime.loadLibrary0(Runtime.java:1012)
(standard input)-977-May 18 09:55:48 05-18 09:55:48.597 11584 11584 E ACRA    :                 at java.lang.System.loadLibrary(System.java:1669)
(standard input)-978-May 18 09:55:48 05-18 09:55:48.597 11584 11584 E ACRA    :                 at com.sun.jna.NativeLibrary.loadLibrary(NativeLibrary.java:218)
(standard input)-979-May 18 09:55:48 05-18 09:55:48.597 11584 11584 E ACRA    :                 ... 13 more
(standard input):980:May 18 09:55:48 05-18 09:55:48.597 11584 11584 E ACRA    :         Suppressed: java.io.IOException: Native library (android-x86/libvosk.so) not found in resource path (.)
(standard input)-981-May 18 09:55:48 05-18 09:55:48.597 11584 11584 E ACRA    :                 at com.sun.jna.Native.extractFromResourcePath(Native.java:1119)
(standard input)-982-May 18 09:55:48 05-18 09:55:48.597 11584 11584 E ACRA    :                 at com.sun.jna.NativeLibrary.loadLibrary(NativeLibrary.java:275)
(standard input)-983-May 18 09:55:48 05-18 09:55:48.597 11584 11584 E ACRA    :                 ... 13 more
(

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:7

github_iconTop GitHub Comments

1reaction
nshmyrevcommented, May 18, 2021

You don’t need to run build-vosk.sh, you can simply copy the .so files from the previous aar to jniLibs folder.

0reactions
nshmyrevcommented, Dec 11, 2022

@nadeeshi so files are inside vosk-android jar.

You need ndk part in build.gradle to include them:

https://github.com/alphacep/vosk-android-demo/blob/master/app/build.gradle#L16

Read more comments on GitHub >

github_iconTop Results From Across the Web

Please help me locate com.alphacep:vosk-android:0.3.17 #146
I am unable to compile that specific commit (to build that aar) in the alphacep/vosk-api repo - I encounter so many errors.
Read more >
Vosk Installation - Alpha Cephei
Describe the purpose of the project. Python installation from Pypi. The easiest way to install vosk api is with pip. You do not...
Read more >
Android - AAR file causes errors - Stack Overflow
1 Answer 1 ... I just found the reason of this error. The aar file doesn't contain the nested (or transitive) dependencies and...
Read more >
1.05 Runtime c++ error - Page 4 - Matrix Games Forums
seems to crash while attacking with 17th army on turn two north of Brest Litovosk pocket, but is rarely the same combat. I...
Read more >
declare repository providing the artifact, see the documentation
DevOps | Creating a Maven Repository With JFrog Artifactory | NetBook | D02 YouTube995 views·1y ... Execution failed for task ':app:checkDebugAarMetadata'.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found