Exception loading pocketsphinx_jni while running PocketSphinxDemo on Android device

StackOverflow https://stackoverflow.com/questions/17580893

  •  02-06-2022
  •  | 
  •  

Pregunta

I've been trying to get the Pocketsphinx demo for Android running on a device for a couple days now. Whenever I try to run the demo, however, I get this error in LogCat:

FATAL EXCEPTION: main
java.lang.ExceptionInInitializerError
    at java.lang.Class.newInstanceImpl(Native Method)

then a bunch of more errors, but the important last one is

    at edu.cmu.pocketsphinx.demo.PocketSphinxDemo.<clinit>(PocketSphinxDemo.java.18)

Line 18 in PocketSphinxDemo.java is

System.loadLibrary("pocketsphinx_jni");

When I go to the pocketsphinx_jni folder, located in /PocketSphinxAndroidDemo/obj/local/armeabi/objs-debug, it appears to be empty. I am running ubuntu, if that is at all relevant. Is there anything that should be in this folder? What is causing this error? Any sort of answer is greatly appreciated.

¿Fue útil?

Solución

When I go to the pocketsphinx_jni folder, located in /PocketSphinxAndroidDemo/obj/local/armeabi/objs-debug, it appears to be empty.

System.loadLibrary doesn't load a folder, it loads a library. libpocketsphinx_jni.so is a library built with ndk-build during the build process. objs-debug/pocketsphinx_jni is a temporary folder used to build this library, its supposed to contain temporary files. The library itself must be located in Demo/libs/armeabi/ libpocketsphinx_jni.so

Is there anything that should be in this folder?

In this particular folder you should have files like pocketsphinx_wrap.o.d. Those files are created with ndk-build.

What is causing this error?

You didn't run ndk-build or there were errors during ndk-build and you ignored them.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top