JNI Invocation interface : SIGSEGV reported during jni call
I have a protocol implementation in which a part of the protocol requires writing metadata into the database, more precisely the protocol is about syncing songs between a host system and a mobile handset.
The protocol implementation is in C/C++ and for the database we use sqlite as the back end and the implementation uses android content provider in java. In addition we use JNI Invocation to pass the song metadata from C to Java.
This im开发者_运维知识库plementation works for a few songs but when a large number of songs(say 50) are synced at once the syncing stops abruptly after syncing around 37-38 songs approx.
This is happening due to a SIGSEGV, we got to know this from /data/tombstones and found out that the crash always happens during the JNI invocation, the call to env->method.
Please let me know what could be the problem and possible solutions to this.
Any time you're using JNI you should use CheckJNI: http://android-developers.blogspot.com/2011/07/debugging-android-jni-with-checkjni.html
It'll tell you what you're doing wrong and abort cleanly.
(Plus, no-one is going to be able to debug a crash without a stack trace.)
精彩评论