android-ndk

How can I catch SIGSEGV (segmentation fault) and get a stack trace under JNI on Android?

I'm moving a project to the new Android Native Development Kit (i.e. JNI) and I'd like to catch SIGSEGV, should it occur (possibly also SIGILL, SIGABRT, SIGFPE) in order to present a nice crash reporting dialog, instead of (or before) what currently happens: the immediate unceremonious death of the process and possibly some attempt by th...

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 STLPort. Thanks! EDIT: Looks like another option may be CrystaX .NET. From their website: ....

Any experience with Android NDK?

I'm specifically interested in how portable it is between various phones. We have an application with some computation heavy code we'd like to share between Android and iPhone. If we could write it in C, we'd have a single code-base, but if the NDK only supports a subset of the processors that phone manufacturers are creating, or if we h...

Does Java pass by reference or value to C when using JNI ( more specifically Android NDK)

Does Java pass by reference or value to C when using JNI ( more specifically Android NDK) ...

Android NDK: Autogenerate function declarations?

I am trying to use a pre-existing native C library in my android project.. The library builds just fine with the NDK tools... Now what I've come to understand is that I cannot just call into the library, but my library needs to include jni.h and add specific function declarations, like for example: JNIEXPORT jint JNICALL Java_com_MultP...

Android - How to enable CheckJni for NDK development?

Hi. Can someone please tell me if I'm missing something here? I am trying the following commands in shell. $ ./adb shell stop $ ./adb shell setprop dalvik.vm.checkjni true $ ./adb shell start But Logcat always shows "CheckJNI is OFF" when I install the apk onto the device.. Is there something else in eclipse that I need to do to enabl...

dose Anybody know what "JNI WARNING: threadid=5 using env from threadid=3" neans?

Full exception is below 12-24 08:59:24.800: WARN/dalvikvm(743): JNI WARNING: threadid=5 using env from threadid=3 12-24 08:59:24.800: WARN/dalvikvm(743): in Ldalvik/system/NativeStart;.run ()V (GetObjectClass) 12-24 08:59:24.800: INFO/dalvikvm(743): "HeapWorker" daemon prio=5 tid=5 VMWAIT 12-24 08:59:24.800: INFO/dalvikvm(7...

What is the fastest way to draw a lot of Points in OpenGL ES?

I'm making a game for android where I need to draw a lot of points that change position every frame. I use the ndk to get faster processing performance of the math/physics section of the game, so I need to use OpenGL to get the fastest performance. Right now, I make a texture every frame out of an array that holds the colors of every p...

File Operations in Android NDK

I am using the Android NDK to make an application primarily in C for performance reasons, but it appears that file operations such as fopen do not work correctly in Android. Whenever I try to use these functions, the application crashes. How do I create/write to a file with the Android NDK? ...

Java JNI - associating resources allocated in C with java objects?

I want to allocate some memory in C and keep it associated with a java object instance, like this: void configure(JNIEnv *object, jobject obj, ....) { char *buf = new char[1024]; // associated <buf> with <obj> somehow } And then later free the memory when the java object gets garbage collected - I could do this by calling a JNI fu...

Read txt file in res/raw/ within Android NDK

I have a file within my application that I want to have included within the .apk for my android app that is a .txt file. My application is almost entirely written in C through the use of the NDK, using OpenGL as well. I know I can bundle the txt file by placing it in /res/raw/, but is there anyway I can access this within the android N...

Trouble with Native OpenGL Renderer

I am using Native code to render OpenGL in Android and I get periodic errors that look like this: ERROR/IMGSRV(1435): frameresource.c:610: WaitUntilResourceIsNotNeeded: PVRSRVEventObjectWait failed ERROR/IMGSRV(1018): sgxif.c:124: WaitForRender: PVRSRVEventObjectWait failed ERROR/IMGSRV(1435): osfunc_um.c:318: PVRSRVEventOb...

Blocking Dialog from within JNI code

I'm writing an app that's basically a wrapper around a 250K JNI. The JNI (a game engine) has APIs like handle_penUp(int x, int y). Sometimes it needs to query the user from inside handle_penUp() (via callbacks into Java code), so the dialog I use to implement the query must block. I understand that the main thread of execution can't b...

Android NDK future extended support for C++

Is there any info about the future of extending the safe C++ header list in the NDK (or maybe some hints to what might be safe to use) ? Or how soon we can expect the next NDK update? Also will there be any tutorials and documentation comming out for the NDK? Thanks ...

What could cause SIGSEGV when calling NewObjectArray for JNI in Android?

I just started working with the Android NDK but I keep getting SIGSEGV when I have this call in my C code: jobjectArray someStringArray; someStringArray = (*env)->NewObjectArray(env, 10, (*env)->FindClass(env,"java/lang/String"),(*env)->NewStringUTF(env, "")); Base on all the example I can find, the above code is correct but I keep g...

too few template-parameter-lists with stlport in Android-NDK

When trying to compile some c++ code with the Android-ndk in cygwin i keep getting the error" error: too few template-parameter-lists" many times. I am not sure if using the STLport would have an influence on this error but i have that installed as well. I doubt this had anything to do with the problem because i am pretty sure i was gett...

why android:background="" is giving error ?

dear friends, i dont what to give any background to activity when i leave this propery blank it gives me error and i have tried using @null as a value but it shows black background. can any one guide how to make it transparent?? ...

Android NDK C++ JNI (no implementation found for native...)

I'm trying to use the NDK with C++ and can't seem to get the method naming convention correct. my native method is as follows: extern "C" { JNIEXPORT void JNICALL Java_com_test_jnitest_SurfaceRenderer_drawFromJni (JNIEnv* env, jclass c) { // } } with a header wrapped in extern "C" {} aslo. Everything compiles fine, creates a .so ...

OpenCV NDK Android help

I am assuming that using the OpenCV code here: http://github.com/billmccord/OpenCV-Android#readme is the best way to use OpenCV on Android, with the NDK. I am still stuck as to how i get from the C definitions of functions to the ones i declare in OpenCV.java in my Android project (example: cvFindContours( void* img, CvMemStorage...

Copying a byte buffer with JNI

I've found plenty of tutorials / questions on Stackoverflow that deal with copying char arrays from C/JNI side into something like a byte[] in Java, but not the other way around. I am using a native C library which expects a byte array. I simply want to get data from a byte[] in java, into preferably an unsigned char[] in C. Long stor...