最近遇到了一个bad arguments passed to
的崩溃,这个是art那边的打印reflection.cc#434,在参数解析的时候出现了问题,是参数不对导致的。结合上一个log就能快速知道具体是那个参数的类型不对。
- 参数无法解析
LOG(ERROR) << "Internal error: unresolvable type for argument type in JNI invoke: " << m->GetTypeDescriptorFromTypeIdx(type_idx) << "\n" << self->GetException()->Dump();
- 引用类型(类型不对)
LOG(ERROR) << "JNI ERROR (app bug): attempt to pass an instance of " << argument->PrettyTypeOf() << " as argument " << (i + 1) << " to " << m->PrettyMethod();
- 布尔类型(只接受JNI_TRUE JNI_FALSE)
LOG(ERROR) << "JNI ERROR (app bug): expected jboolean (0/1) but got value of " << arg << " as argument " << (i + 1) << " to " << m->PrettyMethod();
- Bye类型(越界)
LOG(ERROR) << "JNI ERROR (app bug): expected jbyte but got value of " << arg << " as argument " << (i + 1) << " to " << m->PrettyMethod();
- Char类型(越界)
LOG(ERROR) << "JNI ERROR (app bug): expected jchar but got value of " << arg << " as argument " << (i + 1) << " to " << m->PrettyMethod();
- Short类型(越界)
LOG(ERROR) << "JNI ERROR (app bug): expected jshort but got value of " << arg << " as argument " << (i + 1) << " to " << m->PrettyMethod();