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
43
votes
3 answers

NDK - How to use a generated .so library in another project

I have used ndk successfully to build & use a .so file in one project. I need to use this library in another project. I would rather not copy the source there, but just use the library. Trying to copy & paste the whole libs/armeabi/libcommon.so to…
OceanBlue
  • 9,142
  • 21
  • 62
  • 84
43
votes
3 answers

How to find the path to NDK?

I installed NDK using Android Studio (SDK Manager). Where is the default directory of NDK for Mac? How do I find the path to it?
Lucky_girl
  • 4,543
  • 6
  • 42
  • 82
43
votes
2 answers

Unsatisfiedlinkerror OpenALPR test project for android

For a few days I'm trying to build OpenALPR example project for Android. It builds and launches, but after calling native method for recognizing it make exception: java.lang.RuntimeException: An error occured while executing doInBackground() at…
Ircover
  • 2,406
  • 2
  • 22
  • 42
43
votes
2 answers

Fingerprint Scanner using Camera

Working on fingerprint scanner using camera or without, its possibility and its success rate?, I came across one of open source SDK named FingerJetFX its provide feasibilty with android too. The FingerJetFX OSE fingerprint feature extractor is…
RobinHood
  • 10,897
  • 4
  • 48
  • 97
42
votes
3 answers

Difference between static and shared libraries in Android's NDK?

I'm new to Android's NDK and I don't understand the differences between static and shared libraries. What are they, and when would I choose one type over the other?
hara
  • 3,274
  • 4
  • 37
  • 55
42
votes
9 answers

NDK is not configured issue in android studio

My Application is built successfully on Eclipse but fails to Build on android studio. It returns the error code Ndk is not Configured. Then I've added ndk path to build.gradle then its showing the following error: Information:Gradle tasks…
user4683997
42
votes
5 answers

Why do some Android phones cause our app to throw an java.lang.UnsatisfiedLinkError?

We're experiencing a java.lang.UnsatisfiedLinkError on some of the Android phones that are using our app in the market. Problem description: static { System.loadLibrary("stlport_shared"); // C++ STL System.loadLibrary("lib2"); …
42
votes
3 answers

Android NDK: WARNING: APP_PLATFORM android-9 is larger than android:minSdkVersion 8

I am getting the following warning when compiling my cocos2d-x project with cygwin. `/cygdrive/e/project/MyGame/proj.android ` /cygdrive/e/android-ndk-r8e/build/core/add-application.mk:128: Android NDK: WARNING:APP_PLATFORM android-9 is larger than…
glo
  • 1,408
  • 3
  • 25
  • 54
42
votes
3 answers

Android ndk-build ignoring APP_ABI := x86

I'm trying to run NDK to compile native code to run on Atom(x86) processor as well as ARM. No matter how I set APP_ABI, NDK is generating armeabi library. Even if I put only x86 for APP_ABI. And the file size is always the same. here is my…
Code Droid
  • 10,344
  • 17
  • 72
  • 112
41
votes
4 answers

Creating a product SDK: How do I add a native lib (.so) and a jar with the SDK I am creating?

I am creating a widget that we will provide to developer end users and it consists of a .jar and a native library (.so) built using the NDK. The JAR has a JNI interface to the dynamic library. It's very clear on how to include an external .jar in a…
The Sarge
  • 411
  • 1
  • 4
  • 3
41
votes
4 answers

How to use NDK? Starting with 'hello world' app

I would like to see a 'Hello world' program written in C/C++ but made to run on Android. I know this is possible by using NDK and JNI calls. But not able to make it work. No guides online are helpful. Need to know to to get started. I am developing…
user517400
41
votes
4 answers

How can I add .so files to an android library project using gradle 0.7+

Project structure: App project --> depends on Library project Library Project has a folder for the compiled jni libs jniLibs.srcDirs = ['libs'] And I've tried adding the following to the android element of the build.gradle as per the example app…
Alec Holmes
  • 3,625
  • 4
  • 22
  • 23
40
votes
10 answers

NDK does not contain any platforms

I want to install NDK to be able to use C/C++ native libraries. Upon trying to install the NDK, i get an error saying I do not have enough disk space in my C: Drive (because the download location is to the Temp Folder). I've tried changing the temp…
EliKatz
  • 441
  • 1
  • 4
  • 7
40
votes
3 answers

How to find the ndk revision number for your android setup

Is there a means to find the ndk revision number ideally from the cmd line or from within android studio? My use case is android studio has run an update, replaced ndk-bundle with the latest version and I want to be able to find out what revision…
bph
  • 10,728
  • 15
  • 60
  • 135
40
votes
3 answers

How to compile a static library using the Android NDK?

I'm trying to compile a static library to use on Android but I can't figure out how to compile it. The library uses standard libraries (stdio.h etc...) and libxml2. I am trying to compile using arm-eabi-gcc but I get the following…
Reimund
  • 2,346
  • 1
  • 21
  • 25