如果我使用这个:
if(!env->FindClass("com/test/app")){
Log("Not found");
return 0;
}
I got error: no such class
如文档中所述,FindClass
可能导致抛出各种(Java)异常。
使用挂起的Java异常进行任何进一步的JNI调用都是错误的。因此,您至少需要使用env->ExceptionClear()
清除异常。