Skip to main content

Posts

Showing posts with the label android-ndk

Using the STL with Android NDK C++

I am trying to use the STL in an Android NDK C++ File. I try to use map, vector and various other stl classes and I cannot compile it because it doesn't find the files. My classes header starts with: #pragma once #include <map> #include <iostream> #include <stdexcept> #include <vector> #include <set> #include <list> #include <algorithm> and I get following error messages: 2> In file included from jni/../../Classes/Assist/Test.cpp:1: 2> jni/../../Classes/Assist/Test.h:2:15: error: map: No such file or directory 2> jni/../../Classes/Assist/Test.h:3:20: error: iostream: No such file or directory 2> jni/../../Classes/Assist/Test.h:4:21: error: stdexcept: No such file or directory 2> jni/../../Classes/Assist/Test.h:5:18: error: vector: No such file or directory 2> jni/../../Classes/Assist/Test.h:6:15: error: set: No such file or directory 2> jni/../../Classes/Assist/Test.h:7:16: error: list: No such file or dire

OpenCV with Android

I'm just after setting up OpenCV for android in Eclipse following this tutorial , I have the samples which do not use native c running fine on my phone. The problem is when I try to run the native code samples, I followed all the steps on the next page for setting up the builder in eclipse but when I try to run the samples on my phone they crash. I have used NDK before and successfully set up tesseract for android using the command line to compile the native code instead of eclipse. I think the problem is due to unsatisfiedLinkError:Couldn't load native_sample:findLibrary returned null but I am unsure. I have a screenshot here if that helps. Any suggestions would be more than welcome !!

popen on android NDK

Is popen not supported by android NDK? I read this page and wondering if this is true The same is possible with POSIX popen() but it is not currently supported by bionic, so you can't use that in Android JNI. Instead you can probably use the system() and pipe the output to a file and then read that file afterwards. Looks like the Java approach will be cleaner if you will be doing the rendering in Java. But I also read someone suggesting to use popen. I also tried it myself but sometime my app crashes and I dont know why. Is popen safe to use in android ndk?