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

前端 未结 5 1764
春和景丽
春和景丽 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:42

    I have the same problem,and it confuse me 2 days.Finally the reason is that I pass the wrong object type.For example, the java code is

    public OverlayLine(int mWidth,List mPoints);
    

    and I register jni method as below:

    gClass.mInitMethod = env->GetMethodID(gObject, "", "(ILjava/lang/Object;)V");
    

    and gets the error message as Errol encounter.And I fix the code

    gClass.mInitMethod = env->GetMethodID(gObject, "", "(ILjava/util/List;)V");
    

    and the error gone.That you should pass the precise object type rather than 'Ljava/lang/Object;'.

提交回复
热议问题