I'm looking for reference documentation for the NDK libraries, anyone know where to find them? not java APIs. I can't find any in the NDK directory or online.
Using Android Studio 2.2 and higher, you can use the NDK to compile C and C++ code into a native library and package it into your APK using Gradle, the IDE's integrated build system. Your Java code can then call functions in your native library through the Java Native Interface (JNI) framework.
It is important to mention that some Android Apps use NDK to achieve a specific functionality. That makes NDK and SDK somehow complementary in some cases. However, Android still recommends to only used NDK if you really need to.
The Android NDK is a toolset that lets you embed components that make use of native code in your Android applications. Android applications run in the Dalvik virtual machine. The NDK allows you to implement parts of your applications using native-code languages such as C and C++.
Android provides Native Development Kit (NDK) to support native development in C/C++, besides the Android Software Development Kit (Android SDK) which supports Java. [TODO] more.
Yes the API documentation of the NDK is very sparse. Most of the docmentation is in the docs folder of the NDK itself. Also the examples are helpful.
Try to read through the "standard" JNI documentation. (http://java.sun.com/docs/books/jni/) The Android NDK is basically just JNI. But the Android ndk does not need the special header magic if you name your function accordingly.
for example:
a java class:
package com.example.foo;
class Bar {
native void jnistuff();
}
where you call jnistuff the NDK will look for the method:
void Java_com_example_foo_Bar_jnistuff(JNIEnv* env, jobject *self)
{
[...]
}
and automatically call it. Do not forget "extern C" if you use C++
The best documentation for NDK libraries is the folder with corresponding headers $NDK/platforms/android-n/arch-arm/usr/include
. Do not overlook it.
As others have noted, $NDK/docs
and http://developer.android.com/sdk/ndk/overview.html are also essential.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With