Questions tagged [android-ndk]

The Android Native Development Kit (NDK) is a companion tool to the Android SDK that lets build performance-critical portions of apps in native code or port existing libraries in C/C++ to Android. It provides headers and libraries that allows to build activities, handle user input, use hardware sensors, access application resources, and more, when programming in C/C++.

Android NDK applications that include Java code and resource files and and/or source code (and sometimes code). All native code is compiled into a dynamic linked library (.so file) and then called by Java in the main program using a mechanism:

Android NDK Application

The NDK is a powerful tool for developing Android applications because it:

  • Builds performance-critical portions of your applications in native code. When using Java code, the Java-based source code needs to be interpreted into machine language using a virtual machine. In contrast, the native code is compiled and optimized into binary directly before execution. With proper use of native code, you can build high performance code in your application, such as hardware video encoding and decoding, graphics processing, and arithmetical operation.
  • Reuses legacy native code. C/C++ codes can be compiled into a dynamic library that can be called by Java code with a JNI mechanism.

More information:

Latest Version: NDK Downloads

Version History: NDK Archives

Resources:

FAQ:

Books:

13539 questions
5
votes
2 answers

Android - Calling System.loadLibrary() causes process to die

I've decided to take on porting a game, that uses SDL libraries and makes heavy use of C++ and the STL, over to Android. I've been successful in getting all the required libraries compiled as well as all the source files for the game. My problem…
clark
  • 507
  • 7
  • 14
5
votes
4 answers

Header-only C++ library (GLM) doesn't compile with Android-NDK

I want to use the GLM (glm.g-truc.net) header-only C++ library in an Android NDK project, but I get compile errors. In the Android.mk, I've added the header search path LOCAL_CFLAGS += -I/Users/Johannes/Development/glm_include/ and I've also tried…
j00hi
  • 5,420
  • 3
  • 45
  • 82
5
votes
2 answers

Trouble calling on a Java method from a native thread using JNI (C++)

I have a JNI problem which I hope someone can help me out with. I'm trying to call on a constructor of a Java class called LUSOutputJNI from a native thread. It keeps failing on FindClass(...) of this specific class. Here is the code: LOGE("1"); …
Ita
  • 1,282
  • 1
  • 15
  • 21
5
votes
1 answer

Android NDK - problem linking an external library (can't found it)

I am working with Android NDK r6b under cygwin (the system is updated correctly). I am modifying the hello-jni sample in order to learn working with NDK. Since i have a library written in C++ that i wish to use in the hello-jni (actually, i have…
Luke
  • 641
  • 3
  • 8
  • 14
5
votes
1 answer

Android NDK: Assertion failure: TARGET_PLATFORM is not defined

When using NDK r5b, when I do a build in my jni directory using $NDK_DIR/ndk-build it works fine. But When I switch to r6b (just by setting $NDK_DIR differently) and run that same command, I get…
Scott C Wilson
  • 19,102
  • 10
  • 61
  • 83
5
votes
1 answer

FindClass cannot find custom Java class

I have a purely native app, as I use the android_native_app_glue and the entrypoint to my app is android_main(..) I also have a Java helper type class: package abc.def.ghi public class MyJavaClass extends Activity { public void…
lost_bits1110
  • 2,380
  • 6
  • 33
  • 44
5
votes
1 answer

Dynamic Graph Plotting with openGL in Android

I want to plot real time data from a bluetooth device. I have a Bluetooth device that the phone will connect to and read the data coming from it. The data is voltage levels from some sensors and having a sample rate of 300 samples per sec. Most…
JPM
  • 9,077
  • 13
  • 78
  • 137
5
votes
1 answer

Linking FFTW into an Android NDK application

I am currently writing a genre classification application as my final year project in Computer Engineering. I initially wrote the feature extraction code (implementing FFTW) in C and now I need to implement it on Android via the NDK. This is my…
JonoCoetzee
  • 969
  • 2
  • 15
  • 30
5
votes
0 answers

what's the difference between -funwind-tables and -fasynchronous-unwind-tables?

I've searched for a while about what's the difference between -funwind-tables and -fasynchronous-unwind-tables, but it seems there was not an exactly answer which could give a clear explanation. In other worlds : What's the difference between…
lirui
  • 1,433
  • 1
  • 12
  • 19
5
votes
3 answers

Android Studio NDK "hello from C++" project can't debug (can't set breakpoint)?

Android Studio is BumbleBee 2021.1.1 Path 2, just new a Native C++ project, the Build menu | Edit Build Types, click debug, jni Debuggable selects "true", the Run | Edit configuration, Debugger tab, selects "Native only", in native-lib.cpp, set a…
bigtang5
  • 277
  • 2
  • 9
5
votes
4 answers

Unconventional and dodgy Android crash in during JNI/OpenGL ES loading code

Bounty Since this is an important problem to me I've stuck a bounty on. I'm not looking for the exact answer -- whatever answer leads me to fix this problem gets the bounty. Please make sure you've seen the edit just below. Edit: I've since managed…
Kaganar
  • 6,540
  • 2
  • 26
  • 59
5
votes
0 answers

Android 11 SAF - native fdopendir + readdir dont show full files list

In my application I use native function fdopendir. From java I get file descriptor which I put inside this function. Using it's result I can read content of the directory. On android 11 while listing the directory I see only media files. How to get…
5
votes
2 answers

Tool to generate an Android.mk

I have a big C++ project that has about hundred source files that are located in a bunch of sub folders. They were initially developed using Xcode IDE, so there are no makefiles there. Now I need to build it for Android using NDK. I understand how…
givi
  • 1,883
  • 4
  • 22
  • 32
5
votes
2 answers

Simulating touch event on android over other apps without affecting user interface(with root)

I have a task like, need to simulate touch/swipe event at the given co-ordination over other apps(On any screen of the phone) at the same time without affecting user interaction(Like both Programmatic simulation and User touch input needs to happen…
Suresh
  • 701
  • 1
  • 6
  • 20
5
votes
0 answers

Why is the `EVP_get_cipherbyname` symbol exported only on some Android devices?

I have an app built with Qt for Android. The app is shipped with a custom built openssl version. This works on most devices, however, on a couple of devices it crashes as soon as an https request is done. One example is the SAMSUNG-SM-G930AZ, API…
Matthias Kuhn
  • 1,162
  • 2
  • 14
  • 42