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

Linking with versioned shared library in Android NDK

I am trying to load two shared libraries in my Android application through the loadLibrary call: System.loadLibrary("mywrapper"); System.loadLibrary("crypto"); I keep running catching the `UnsatisfiedLinkError. Here is a more detailed version of…
feverDream
  • 283
  • 2
  • 16
6
votes
1 answer

Loading FMOD purely from native code

I found an example called nativeactivity in FMOD example folder, but unfortunately it use some java code: package org.fmod.nativeactivity; public class Example extends android.app.NativeActivity { static { …
SMGhost
  • 3,867
  • 6
  • 38
  • 68
6
votes
2 answers

Is is possible to build Android games in Go using the NDK with cgo and/or SWIG or similar?

Is it possible to use Go to build Android games at all? I'm not wedded to the technologies mentioned in the subject line. I know that some people have built some Android programs in Go, but they may have been headless.
Curyous
  • 8,716
  • 15
  • 58
  • 83
6
votes
3 answers

porting libcurl on android with ssl support

I am trying to port libCurl to android with SSL support, step one would be to port the curl without ssl support I guess so I started doing that. but I run into a problem. as I read on the dev website and in the Android.mk file, the hard part is…
Tancho
  • 1,581
  • 3
  • 22
  • 40
6
votes
5 answers

UDP/RTCP Packets not reaching Device/Application Whens device screen is Locked

My VOIP Android Application has the C/Native Library which does all business logic of login/Logout etc. Issue with this is when the device screen is locked the application(c Code) is not able to receive any packets from the server. I verified this…
NitZRobotKoder
  • 1,046
  • 8
  • 44
  • 74
6
votes
2 answers

Android: Getting random number from JNI method

I am creating a demo of math operation like addition, subtraction, multiplication and division using NDK. I am able to make the library and getting the response from the native code but result is not proper I mean it is random static…
Dharmendra
  • 33,296
  • 22
  • 86
  • 129
6
votes
2 answers

Android NDK - using AssetManager in native code

I need to work with assets in my assets folder from within C/C++ code. Is it safe to cache pointer to AAssetManager like this...: AAssetManager* assetMgr = NULL; void Java_com_example_createAssetManager(JNIEnv* env, jclass clazz, jobject…
Tom Atom
  • 139
  • 1
  • 11
6
votes
2 answers

OpenCV 2.4.1: UnsatisfiedLinkError

I have an android project, that has native code. In this native part I use OpenCV. Everything compiles and works OK when I use OpenCV 2.3.1, but when I tried to switch to version 2.4.1, I faced problem: It compiles without any errors, but when I…
Arseniy
  • 1,737
  • 1
  • 19
  • 35
6
votes
5 answers

How do I fix Eclipse CDT Error "Function 'isdigit' could not be resolved" with Android NDK?

I am using Eclipse Indigo with an Android/NDK mixed project. I've added C++ nature and almost everything is working. Automatic builds work; that is, when I edit a file ndk-build is invoked and completes successfully - no build errors. Mouseover…
ajh158
  • 1,477
  • 1
  • 13
  • 32
6
votes
1 answer

How to use Android system FreeType library in native code?

I use FreeType in my Android applications as a static library which i compile myself. I want to make my app smaller so i'm looking for a possibility to use the system version of FreeType. Is it possible to do? Is it a stable API?
Sergey K.
  • 24,894
  • 13
  • 106
  • 174
6
votes
2 answers

How to access own libmediaplayerservice library from libmedia_jni in Android Gingerbread

By default android Gigerbread 2.3 use PV_Player(opencore library). I found one solution just it should be patched system build.prop file, but I don't want to patch system. I want to create my own library using android media frame work which will use…
Suvam Roy
  • 1,282
  • 2
  • 11
  • 21
6
votes
1 answer

Fastest way to read/write a Bitmap from/to file?

I'm currently writing Bitmaps to a png file and also reading them back to a Bitmap. I'm looking for ways to improve the speed at which writing and reading happens. The images need to be lossless since I'm reading them back to edit them. The place…
Jona
  • 13,325
  • 15
  • 86
  • 129
6
votes
2 answers

multiple (my and 3rd-party) native libraries in Android NDK

I have to use two native libraries: one is my own and the other one is 3rd-party. As long as I used them in separate projects, everything was ok. But now I'm getting the Exception Ljava/lang/UnsatisfiedLinkError. I'm using Eclipse. I found out that…
6
votes
3 answers

OpenCV undefined references

I'm trying to link my JNI Android application with OpenCV but I get these errors ./obj/local/armeabi /libopencv_calib3d.a(calibinit.cpp.o): In function `cvDrawChessboardCorners': calibinit.cpp:(.text+0x20a): undefined reference to…
givi
  • 1,883
  • 4
  • 22
  • 32
5
votes
2 answers

How to write Android.mk file with source files in sub directories?

I have a structure like this: folder1 |--subfolder1 |--.cpp files .h files |--other .cpp files folder1 contains cpp files and 1 subfolder which also contains cpp files and head files How will I write my Android.mk file so…
Coola
  • 479
  • 1
  • 8
  • 15