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 NDK with C++ Graphics Engine

I would like to use the C++ Graphics Engine (Ogre3D) I am familiar with to write some games for Droid (I just cannot get used to Java) and there are plenty of write ups on how to build the applications. However, I have been unable to get an answered…
user470760
5
votes
4 answers

Unresolved inclusion:

I have some troubles with eclipse & sequoyah. I wrote a simple app, and without sequoyah it builds successfully. But it falls in emulator, so I decided to use sequoyah for native debugging. And after sequoyah's installation I see that unresolved…
SirHamlet
  • 143
  • 1
  • 2
  • 7
5
votes
1 answer

Run C++ code in Java Android app using JavaCPP

I a beginner when it comes to development for Android and I am trying to understand JavaCPP. I want to execute a C++ function from Java inside an Android application. In my example I just use a simple TextView widget that prints what I receive from…
Jacob Krieg
  • 2,834
  • 15
  • 68
  • 140
5
votes
0 answers

Error when loading Android APK via ADB - StorageManager.getVolumes()' on a null object reference

I am getting the error below when i attempt to load a custom APK on to Android. It's an empty test service. Thanks, -Eric adb: failed to install test.apk: Exception occurred while executing: java.lang.NullPointerException: Attempt to invoke…
5
votes
3 answers

Is it justified to use C/C++ for iOS/Android cross platform code in this case?

I am planning to write a mobile application (iOS and Android) where there is a lot of image recognition processing. Is it a good solution to write the image recognition code in C or C++ to reuse it in both platforms ? Will there be a lot platform…
zercvb
  • 53
  • 4
5
votes
3 answers

Solution for missing std::wstring support in Android NDK?

I have a game which uses std::wstring as its basic string type in thousand of places as well as doing operations with wchar_t and its functions: wcsicmp() wcslen() vsprintf(), etc. The problem is wstring is not supported in R5c (latest ndk at the…
user548569
  • 158
  • 2
  • 6
5
votes
1 answer

Android NDK performance over regular Java code

I've been playing around with the NDK lately, because UI was in need of an efficient implementation of a computationally intensive algorithm. The NDK documentation states: Typical good candidates for the NDK are self-contained, CPU-intensive…
Phonon
  • 12,549
  • 13
  • 64
  • 114
5
votes
1 answer

Using AssetManager class from Android NDK in a Flutter app

I've been trying to use the Android NDK's AssetManager class in my Flutter app, that works with Google Oboe, to access to audio files. Following this example in the Oboe repository, I learned that they obtain the AssetManager from Java like…
Facundo Farall
  • 500
  • 6
  • 18
5
votes
2 answers

Android gradle Upload NDK symbols on every build

I want to upload NDK symbols on every build i do, Under my Android inside gradle i use to have: applicationVariants.all { variant -> def variantName = variant.name.capitalize() println("symbols will be added on varinat ${variantName}") …
Jesus Dimrix
  • 4,378
  • 4
  • 28
  • 62
5
votes
4 answers

Android SQLite R-Tree - How to install module?

http://www.sqlite.org/rtree.html says that the r*tree is "included as part of the amalgamation but is disabled by default" and to enable it "simply compile with the SQLITE_ENABLE_RTREE C-preprocessor macro defined" Well I want to use R-trees in my…
James Coote
  • 1,975
  • 19
  • 29
5
votes
1 answer

Renderscript Fatal signal 11 (SIGSEGV) code 1 (SEGV_MAPERR) fault addr

I am using the camera2 API to get a stream of images of format ImageFormat.YUV_420_888. I need to do some processing on them with a library that requires sending the image as an RGB byte array (so the byte array length = width * height * 3) I used…
Victor Motogna
  • 731
  • 1
  • 12
  • 22
5
votes
3 answers

Android NDK books or other materials

I know that more favorably to use the NDK instead of SDK, if you want to write faster application, so I want to know is there a good books how to programming on NDK? I know C/C++ languages, but I have no idea where to start. And if there aren't…
George
  • 1,327
  • 11
  • 25
5
votes
2 answers

nativeLibraryDir appears empty after updating to Gradle 5.6.4 and Android Studio 3.6.1

It appears that my libraries no longer exist in nativeLibraryDir after updating Gradle from 5.4.1 to 5.6.4 and Android Studio from 3.5.3 to 3.6.1. My current implementation for accessing my libraries is as follows: File libDirectory = new…
Brendan Cordingley
  • 190
  • 1
  • 4
  • 20
5
votes
1 answer

Using OpenGL ES 2.0 FrameBuffer (FBO) and Stencil in android Native code (ndk)

I am trying to generate a frambuffer object and use stencil inside a native android application using the NDK (r5b). Target device is running froyo 2.2, supporting OpenGL ES 2.0. So, I've been coding lots of gl code in my c++ native libs and havent…
oberthelot
  • 1,310
  • 1
  • 11
  • 23
5
votes
1 answer

Android app crash after NDK upgraded from 20.1 to 21.0

I was using Android Studio to create an app using Java, Kotlin and C++. Yesterday, I upgraded the Android NDK from version 20.1 to version 21.0, and then the android studio keeps crash if I connect to my android phone and run. The piece of crash…
Xiaorui Ma
  • 51
  • 1
  • 3