mybigday / whisper.rn

React Native binding of whisper.cpp.
MIT License
377 stars 23 forks source link

library "libwhisper.so" not found #77

Open xclidongbo opened 1 year ago

xclidongbo commented 1 year ago

Gradle:6.7.1 AGP: 4.2.2 ndk: 25.1.8937393

build success, but crash when running.

2023-07-12 17:27:21.351 19245-19275/com.sinosig.meoa.app E/AndroidRuntime: FATAL EXCEPTION: AsyncTask #2
    Process: com.sinosig.meoa.app, PID: 19245
    java.lang.RuntimeException: An error occurred while executing doInBackground()
        at android.os.AsyncTask$4.done(AsyncTask.java:415)
        at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:383)
        at java.util.concurrent.FutureTask.setException(FutureTask.java:252)
        at java.util.concurrent.FutureTask.run(FutureTask.java:271)
        at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:305)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
        at java.lang.Thread.run(Thread.java:923)
     Caused by: java.lang.UnsatisfiedLinkError: dlopen failed: library "libwhisper.so" not found
jhen0409 commented 1 year ago

Here's an simple way to check the libwhisper libraries are actually bundled in apk:

$ANDROID_HOME/cmdline-tools/latest/bin/apkanalyzer files list <PATH_RN_PROJECT>/android/app/build/outputs/apk/debug/app-deubg.apk | grep libwhisper

Expected result:

/lib/x86_64/libwhisper.so
/lib/x86/libwhisper.so
/lib/armeabi-v7a/libwhisper_vfpv4.so
/lib/armeabi-v7a/libwhisper.so
/lib/arm64-v8a/libwhisper_v8fp16_va.so
/lib/arm64-v8a/libwhisper.so

If you don't see anything by the grep filter or it missing on some platforms, you will need to check your root project build configuration, like packagingOptions.