Java JNI vs Android NDK

Can someone explain how the JNI and Android NDK are different, how they match and how they fit together? I did not find anything, which gives a good explanation of the differences between the two, and I'm a bit confused.

Thanks!

+6
source share
2 answers

JNI is just the way Java handles a call in native / C ++ code and is called back in Java. Nothing to say about Android - this is a feature of the Java language.

Android NDK is a way to write Android applications using JNI code. It is Android specific and provides native code for accessing the Android API at this level.

+12
source

The Android NDK (Native Development Kit) is basically a set of tools for reusing code written in C / C ++ (native code). It compiles native code into a native library. The NDK is similar to the Android SDK, with the main difference between using the SDK for Java codes only. NDK is used in applications developed for several platforms, such as iOS, Windows. Applications such as Whatsapp, Instagram were developed using the NDK.

Java code uses JNI (native Java interface) to call functions from its own library, such as access to objects, methods, etc. In addition, native code can access the Java environment.

0
source

Source: https://habr.com/ru/post/1245809/


All Articles