Android JNI DETECTED ERROR IN APPLICATION: JNI GetMethodID called with pending exception

前端 未结 5 1758
春和景丽
春和景丽 2020-12-30 12:09

I\'m trying to run a Googles OCR Tesseract with my android project. I have already complied tesseract with android-ndk and am receiving this error after I try and run the an

5条回答
  •  无人及你
    2020-12-30 12:44

    Faced the similar problem when calling GetMethodID:

    JNI DETECTED ERROR IN APPLICATION: thread Thread[1,tid=15092,Runnable,Thread*=0x791c1b8000,peer=0x7278ab58,"main"] using JNI after critical get
    ...   in call to GetMethodID
    

    A few calls before GetMethodID im use

    inBufP = env->GetPrimitiveArrayCritical(jIn, NULL);
    

    Solution : I can fix native crash by change GetPrimitiveArray to GetByteArrayElements

    jboolean isCopy;
    inBufP = env->GetByteArrayElements(jIn, &isCopy);
    

提交回复
热议问题