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
28
votes
1 answer

Android - writing/saving files from native code only

I'm trying to build an Android app which makes use of the NativeActivity facility of the NDK. I'm having the following structure: a bunch of native shared libraries installed in /system/vendor/; I'm working with a custom built Android…
celavek
  • 5,575
  • 6
  • 41
  • 69
27
votes
7 answers

Using cURL in Android

I would like to use cURL library in my android application in native code (using NDK r5b, the latest). After researching online, it seems the only way to use cURL in android is to build the entire android source tree with curl in it, and somehow…
Nitrex88
  • 2,158
  • 2
  • 21
  • 23
27
votes
3 answers

configure does not recognize androideabi

I am trying to compile a library using android-ndk-r5 standalone toolchain and autotools. When doing a ./configure, it fails with: $ ./configure --host=arm-linux-androideabi ...snip... checking host system type... Invalid configuration…
larvyde
  • 811
  • 1
  • 6
  • 19
27
votes
4 answers

How to get the current time in native Android code?

I was wondering if there is an easy way to get the current time in native Android code. Optimally it would be something comparable to System.getTimeMillies(). I will only be using it to see how long certain function calls will take so a long…
Pandoro
  • 1,062
  • 2
  • 10
  • 28
27
votes
5 answers

Add abiFilters to gradle properties

I want to add ndk.abiFilters property in gradle.properties file. Now I've this property inside build.gradle. Here is part of my build.gradle buildTypes { debug { ndk { abiFilters "x86", "armeabi-v7a", "armeabi" //abiFilters…
Warlock
  • 2,481
  • 4
  • 31
  • 45
27
votes
2 answers

Generate .so file in Android Studio

I'm aware that there are answers related to this, but they're old and outdated. I got Android Studio 1.3 and already downloaded Android NDK. When I run an app, it crashes and gives findLibrary returned null in Logcat. I figured out this was due to…
FadedCoder
  • 1,517
  • 1
  • 16
  • 36
27
votes
4 answers

How to make Visual Studio 2015 installer know that I already have Android SDK?

When I am installing Visual Studio 2015 I realized that it says Java SE Development Kit is already exists on the computer. I think installer knew it because of environment variables. That's why I set ANDROID_SDK_HOME and ANDROID_NDK environment…
27
votes
5 answers

Google Play and OpenSSL warning message

I just received an email from Google play stating: Hello, One or more of your apps is running an outdated version of OpenSSL, which has multiple security vulnerabilities. You should update OpenSSL as soon as possible. For more information about…
Hyndrix
  • 4,282
  • 7
  • 41
  • 82
26
votes
2 answers

Using FFmpeg with Android-NDK

I want to use FFmpeg with Android-NDK and I am very basic in this section, I need some help and I research about this topic before on the net, but got no satisfactory solution. 1 - How can I use FFmpeg through Windows OS. (I do not want to use…
iSun
  • 1,714
  • 6
  • 28
  • 57
26
votes
1 answer

How to Find memory leaks from native code in android

Just wondering if someone knows how to find out memory leaks in native code from android. Google search gives lot of solution, but none of them is full. Please let me know if anybody knows how to do this.
26
votes
6 answers

Android Call Recording Incoming voice not getting recorded

I'm working auto call recorder app, I'm able to record voice call on below android 6 using MediaRecorder.AudioSource.VOICE_CALL, From android 6 not able to record voice call using VOICE_CALL. I managed to record using MediaRecorder.AudioSource.MIC…
26
votes
2 answers

Android: After building platform source, how to sign arbitrary APK with platform key?

As an experiment, I would like to use the platform key of my custom built Android platform to sign an arbitrary APK, that is built via the NDK. What is the process to go about doing this?
zer0stimulus
  • 22,306
  • 30
  • 110
  • 141
26
votes
1 answer

Send custom object using Android native Binder

I can only find examples for Java regarding Parcelable. My goal is to create a simple service and client in native C++ ( not NDK ), that will use Binder to receive and send serialized custom objects. MyClass + std::string + enum + int + bool
Cumatru
  • 695
  • 2
  • 12
  • 34
26
votes
4 answers

Android AAR package for native library

I'm looking for a way to package a native library into an AAR package, so it would be possible to use it via dependencies declaration in gradle script. By native library I mean set of .cpp files or compiled static library and a set of header files.…
igagis
  • 1,959
  • 1
  • 17
  • 27
26
votes
1 answer

YUV to RGB conversion and display using opengl es 2.0 from android ndk using shaders

I am currently working on a rtsp player on android using ffmpeg to connect and decode the video stream. I would like to use OpenGL es 2.0 to convert the YUV frame to RGB frame and display it but i am blocked (it's the first time i use opengl). I…
Lionel B.
  • 261
  • 3
  • 5