leadrien / opencv_native_androidstudio

An android studio project with native Opencv
320 stars 120 forks source link

armeabi-v7a is not support exceptions #13

Closed mikegreen7892003 closed 5 years ago

mikegreen7892003 commented 6 years ago

I added a simple exception in native-lib.cpp and the app crashed.

extern "C"
{
void JNICALL Java_ch_hepia_iti_opencvnativeandroidstudio_MainActivity_salt(JNIEnv *env, jobject instance,
                                                                           jlong matAddrGray,
                                                                           jint nbrElem) {
    try {
        throw logic_error("");
    }
    catch (logic_error) {
    }

    Mat &mGr = *(Mat *) matAddrGray;
    for (int k = 0; k < nbrElem; k++) {
        int i = rand() % mGr.cols;
        int j = rand() % mGr.rows;
        mGr.at<uchar>(j, i) = 255;
    }
}
}

And the program work perfect without lib_opencv.

target_link_libraries( # Specifies the target library.
                       native-lib

                       # OpenCV lib
                       # lib_opencv

                       # Links the target library to the log library
                       # included in the NDK.
                       ${log-lib} )
mikegreen7892003 commented 6 years ago

Is there any problem with armeabi-v7a, opencv and exception?

leadrien commented 5 years ago

Do you have any update on this? I just gave your code a try and it's perfectly working on my device.