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

Ndk-build: CreateProcess: make (e=87): The parameter is incorrect

I get an error when build static lib with NDK on Windows platform: process_begin: CreateProcess( "PATH"\android-ndk-r8b\toolchains\arm-linux-androideabi-4.6\prebuilt\windows\bin\arm-linux-androideabi-ar.exe, "some other commands" ) failed. make…
Oleksandr Shtykhno
  • 766
  • 2
  • 7
  • 12
32
votes
8 answers

Compatible side by side NDK version was not found. Default is 20.0.5594570

I am getting the above error My gradle looks like this apply plugin: 'com.android.application' apply plugin: 'kotlin-android' apply plugin: 'kotlin-android-extensions' android { compileSdkVersion 29 buildToolsVersion "29.0.3" …
Vikram Anand Bhushan
  • 4,836
  • 15
  • 68
  • 130
31
votes
18 answers

Your APP_BUILD_SCRIPT points to an unknown file using Android ndk-build

I get the following error while trying to compile an Android NDK project: ndk-build Android NDK: Your APP_BUILD_SCRIPT points to an unknown file: /home/lambergar/work/APIExample/jni/Android.mk …
LambergaR
  • 2,433
  • 4
  • 24
  • 34
31
votes
2 answers

Android NDK: Link using a pre-compiled static library

I'm trying to port Jnetpcap to Android in order to use it for parsing .pcap files. Jnetpcap is a java wrapper for libpcap which uses JNI. I have compiled libpcap as a static library using the android's source code tree. When compiling Jnetpcap as a…
Jimix
  • 1,539
  • 3
  • 15
  • 20
31
votes
5 answers

Cannot resolve symbol 'tools' and 'GradleException'

I have started to work on an existing project including Android NDK. I have two issues in build.gradle, which is impossible for me to build the app. For your information, my co-worker (who was working on it) was able to build the app. I have already…
Guimareshh
  • 1,214
  • 2
  • 15
  • 26
31
votes
5 answers

How to get Magic Color effect like Cam Scanner using OpenCV

This is the original image. Cam Scanner Magic color effect. My filter on the image. I am changing the contrast of the image. dst.convertTo(dst, -1, 2, 0); Then using Gaussian blur for…
mihirjoshi
  • 12,161
  • 7
  • 47
  • 78
31
votes
7 answers

How to use su command over adb shell?

I need to make a script that executes a lots of thing on Android device, my device is rooted, when I enter on the shell, I can give the command su, and it works but I need pass this command like: adb shell " su; mv /sdcard/Download/app_test…
Alex
  • 3,301
  • 4
  • 29
  • 43
31
votes
1 answer

Building audio processing Little Endian SDK with NDK

I am trying to use ndk-build to use native code for audio processing from Little Endian in an Android application (I don't have JNI yet). When I executed ndk-build in jni dir I got ($USER_PATH is path to directory on my computer): Android NDK:…
piobab
  • 1,352
  • 2
  • 13
  • 21
31
votes
4 answers

when to use JNIEXPORT and JNICALL in Android NDK?

I'm trying to write my own jni sources. Looking at some ndk samples, I found that they often use those macros JNIEXPORT and JNICALL follewed by the name of java package like this JNIEXPORT void JNICALL…
nawara
  • 1,157
  • 3
  • 24
  • 49
31
votes
6 answers

uSTL or STLPort for Android?

I'm working with the Android NDK, and since it does not currently support the STL, I was wondering if there are any brilliant people out there who have had success with this, or know which is better suited for the Android platform: uSTL or…
Andrew Garrison
  • 6,977
  • 11
  • 50
  • 77
31
votes
4 answers

How does native android code written for ARM run on x86?

Motorola just released an x86 based Android phone. I'm a little confused as to how native apps/libraries written for ARM(netflix for example) can run on this phone. I'd be grateful if someone could explain.
Ayush
  • 709
  • 2
  • 8
  • 17
31
votes
1 answer

Android Nexus 7 Jelly Bean: startPreview/takePicture calling getCameraStereoMode logs an error

I just got a Nexus 7 I'm trying to port some code to. The following line works with no problem on a Xoom running Ice Cream: mCamera.startPreview(); It also works correctly on the Nexus 7, but it logs errors: E/NvOmxCamera( 126): OMX_ERRORTYPE…
PapaSloth
  • 488
  • 3
  • 7
30
votes
3 answers

How to create an Android RFCOMM socket without any input from the user?

Here's the scenario: I need to write an application for Android to create a RFCOMM socket to a PC with a Bluetooth dongle (I'm going to write the server too). My requirement is that the user doesn't have to pair device manually. Actually, with a big…
30
votes
1 answer

No symbol directories found - please check your native debug configuration

I'm Using Android studio 2.2 and Android.mk file followed this https://developer.android.com/studio/debug/index.html c++ files located inside Android module and not in the calling application. I added to the module the following: …
BoazGarty
  • 1,410
  • 4
  • 18
  • 38
30
votes
3 answers

Android Studio + Liquid Fun

I'm trying to setup Android Studio + LiquidFun. I follow a lot of tutorials like these: http://www.shaneenishry.com/blog/2014/08/17/ndk-with-android-studio/ http://tools.android.com/tech-docs/android-ndk-preview But either isn't comprehensive or…