Hello!

I am developing a project which has to use native code. Especifically, I 
need to create on the native side an instance of the class MyDecoder, which 
then will do some work. As soon as the MyDecoder constructor is called for 
the first time, the application crashes silently - no exception shown in 
Logcat, no "Force close" dialog on screen, nothing; just the desktop 
showing again.

On the java class which calls it (CamPreview.java), I have already declared 
the native function (private native boolean invokeDecoder(Mat captured); ), 
and on the native side (Decoder.cpp), I have the function:

extern "C" jboolean 
Java_com_example_test011_CamPreview_invokeDecoder(JNIEnv* env, jobject 
javaThis, const Mat &captured)
{

LOGD("A"); //this message is shown
MyDecoder* dec= new MyDecoder( Size(1280,720) );
LOGD("B"); //this message never appears
return false

}

(LOGD is just a macro for writing on LogCat)

Then, MyDecoder's constructor, defined in MyDecoder.cpp, is:

MyDecoder::MyDecoder(Size s) {

LOGD("Constructor started"); //never shows
         // stuff
}

The "A" message before the constructor call is showing (which means all the 
JNI stuff is, hopefully, correctly configured); but then the app closes. 
The constructor doesn't appear to launch (the "Constructor started" text is 
never displayed), but I have no idea where the error might be. I have been 
googling, and the closest thing that I have found is this StackOverflow 
thread<http://stackoverflow.com/questions/11190469/android-app-crashes-suddenly-while-running>
 which 
seems to be related to memory running out. In my case, since it happens on 
the very beginning of the app, and (just to test) I have largeHeap="true" 
on a Galaxy S3 (meaning, 256MB), that doesn't seem very likely.

Do you have any idea about what might be happening?

Thank you in advance!

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to