0

I am trying to learn NDK, and I'd like to use external library (libopus). After reading some articles, I got these steps:

git clone https://android.googlesource.com/platform/external/libopus
mv libopus jni
NDK_PROJECT_PATH=. ndk-build

It crated libs/armeabi/libopus.so file. Yay, awesome! ... And now what? How can I use this library? How can I call its functions and methods?

Also, will my app run on non-ARM architectures (x86, MIPS), because armeabi suggests it'll be ARM only.

1
  • 2
    github.com/tbocek/opus-wrapper libopus is a pretty complex place to startup with ndk because at the interface level you also have to dive into media streams and thread handlers for those streams along with the pointers/references to functions operating on the media streams. Commented Feb 5, 2015 at 15:45

1 Answer 1

1

You can not just use standard Linux libraries. Java/Android uses the Java Native Interface (JNI) which is special C code that builds the bridge between Java part and native part.

It looks like you already have NDK installed. Look into the project samples, e.g. the "hello-jni" project. In this example you can see what JNI C code you have to write and how to access the self written functions from within your Java code.

Regarding the architectures: Yes, an ARM library is for the ARM platform only. If you want to create a cross-platform App you have to compile all native libraries for each supported platform (usually ARM, ARMv7, x86 and MIPS).

Sign up to request clarification or add additional context in comments.

2 Comments

So I'll have to write some additional wrapper in C which will enable opus functions to Java?
If there is not already an existing wrapper or a "Java binding" sub-project of the library you want to use, yes.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.