Tag: android-ndk

Use C library in Android over NDK

What I want to do: I’ve found a C library which computes an audio stream’s pitch and want to use it in Android. I thought instead of porting it I could also use it with the help of the NDK, right? How does this work? I have to install the NDK, of course, and then? […]

Android set thread affinity

Following the answer from this StackOverflow question how do I create the proper integer for mask? I made some googling and the everything I found uses CPU_SET macro from sched.h but it operates on cpu_set_t structures which are undefined when using NDK. When try using CPU_SET linker gives me undefined reference error (even though I […]

Does Android not really have wchar_t?

I built a simple method like below wchar_t buf[1024] = {}; void logDebugInfo(wchar_t* fmt, …) { va_list args; va_start(args, fmt); vswprintf( buf, sizeof(buf), fmt, args); va_end(args); } jstring Java_com_example_hellojni_HelloJni_stringFromJNI( JNIEnv* env, jobject thiz ) { logDebugInfo(L”test %s, %d..”, L”integer”, 10); return (*env)->NewStringUTF(env, buf); } I got following warning In function ‘Java_com_example_hellojni_HelloJni_stringFromJNI’: warning: passing argument 1 […]

Returning an int from native function(c++, jni) crashes application

Trying to figure out why c++ function call returning an int crashes the whole application without any errors/warnings. Here is working code: jint Java_org_ntorrent_DummyTorrentInfoProvider_next( JNIEnv * env, jobject obj, jint number) { jint test = rand(); __android_log_print(ANDROID_LOG_DEBUG, “HelloNDK!”, “rand() = %d”, test); return number; } And this code crashes application without warnings: jint Java_org_ntorrent_DummyTorrentInfoProvider_next( JNIEnv […]

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 configuring the make first. […]

Debugging native libraries for Android OS

I am to create a shared library for Android OS. Although I have done some Android apps in Eclipse I decided to start my native development with Visual Studio and vs-Android add-on: http://code.google.com/p/vs-android/ I am really familiar with VS and Google found that add-on as one of the first results. I have gone through the […]

Undefined reference to AAssetManager_fromJava

I am trying to access assets from an android apk using AAssetManager. However, I keep getting “Undefined reference to AAssetManager_fromJava” even though I’ve included asset_manager.h and asset_manager_jni.h Other functions from asset_manager.h, like AAssetManager_openDir(mgr, “”) etc also can’t be referenced. Here’s the complete code #define EXPORT_API #include <string.h> #include <jni.h> #include <android\log.h> #include <sys\types.h> #include <android\asset_manager.h> […]

Unable to build GStreamer for Android Tutoritals

I’m running into a number of issues attempting to build the GStreamer Android tutorials. My environment is: Mac OS X 7 Android SDK version 17 Android NDK 8d I am able to build and run the NDK samples both in Eclipse and from the command line. I have downloaded http://cdn.gstreamer.com/android/arm/gstreamer-sdk-android-arm-debug-2012.11.tar.bz2 and added the GSTREAMER_SDK_ROOT_ANDROID environment […]

OpenCV undefined references

This question already has an answer here: Why does the order in which libraries are linked sometimes cause errors in GCC? 10 answers

Android Native – When to use 64-bit NDK?

According to NDK’s official download page: http://goo.gl/vI7Oek there are two target versions: x86 Target x64 Target And I was wondering ( as a newbie in the NDK stuff ), does this mean I should use the x64 NDK when compiling an application for devices equipped with x64 processors? And if I need only one “.apk” […]

Android Babe is a Google Android Fan, All about Android Phones, Android Wear, Android Dev and Android Games Apps and so on.