Importing Android NDK projects (to decode OGG)

2019-08-03 04:08发布

I am trying to decode OGG files in Android using an NDK project (I've tried a few). No matter which one I try, I always get an error similar to this when I build:

Caused by: java.lang.UnsatisfiedLinkError: Couldn't load videokit: findLibrary returned null

I'm very new to the NDK (obviously) so I'm not sure what I'm doing wrong. All I want to do is to be able to set the playback rate of an OGG file.

1条回答
▲ chillily
2楼-- · 2019-08-03 04:48

The java part of the code links to a shared library object (.so file), which is obtained by compiling the C++/NDK parts of the code with ndk-build. In this case, your app is not able to find the right .so file to load. Here are a few things you could check for -

  1. Very basic check - did you run "ndk-build" inside the jni folder? If you didn't, no .so file is generated - eclipse will still compile your project, but it won't work.
  2. If your project root directory is PROJECT, check $(PROJECT)/jni/libs/armeabi or $(PROJECT)/jni/libs/armeabi-v7a - either or both of the locations should contain a .so file once you are done with the "ndk-build" command.
  3. Check that somewhere in your java code, you are invoking "System.LoadLibrary" on this .so file. I think it should be "System.LoadLibrary(videokit)", but I am not sure.
查看更多
登录 后发表回答