Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android Studio JNI detected error in application #624

Closed
sufiaji opened this issue Apr 18, 2020 · 3 comments
Closed

Android Studio JNI detected error in application #624

sufiaji opened this issue Apr 18, 2020 · 3 comments

Comments

@sufiaji
Copy link

sufiaji commented Apr 18, 2020

Hi team,

I added output_stream:"DETECTIONS:output_detections" in file face_detection_mobile_gpu.pbtxt and generate AAR so that I can get face landmark (eyes, nose, mouth) in Android Studio. Application successfully started but within few seconds it crashes with below error in Android Studio logcat.

JNI DETECTED ERROR IN APPLICATION: JNI GetObjectClass called with pending exception java.lang.NoClassDefFoundError: com.google.mediapipe.formats.proto.DetectionProto$Detection
at com.google.protobuf.Parser com.google.mediapipe.formats.proto.DetectionProto$Detection.parser() (DetectionProto.java:2530)
at void com.merkaba.fdapp.MainActivity.lambda$onCreate$0(com.google.mediapipe.framework.Packet) (MainActivity.java:94)
at void com.merkaba.fdapp.-$$Lambda$MainActivity$W4IHs8_JiSEesmggE2fzGoufaI4.process(com.google.mediapipe.framework.Packet) (lambda:-1)
Caused by: java.lang.NoSuchMethodError: No static method registerDefaultInstance(Ljava/lang/Class;Lcom/google/protobuf/GeneratedMessageLite;)V in class Lcom/google/protobuf/GeneratedMessageLite; or its super classes (declaration of 'com.google.protobuf.GeneratedMessageLite' appears in /data/app/com.merkaba.fdapp-XNQLDVhmEWMohTQNQIgyRw==/base.apk)
at void com.google.mediapipe.formats.proto.DetectionProto$Detection.() (DetectionProto.java:2519)
at com.google.protobuf.Parser com.google.mediapipe.formats.proto.DetectionProto$Detection.parser() (DetectionProto.java:2530)
at void com.merkaba.fdapp.MainActivity.lambda$onCreate$0(com.google.mediapipe.framework.Packet) (MainActivity.java:94)
at void com.merkaba.fdapp.-$$Lambda$MainActivity$W4IHs8_JiSEesmggE2fzGoufaI4.process(com.google.mediapipe.framework.Packet) (lambda:-1)

in call to GetObjectClass
"Thread-10" prio=5 tid=29 Runnable
| group="main" sCount=0 dsCount=0 flags=0 obj=0x132c0000 self=0x70df76f800
| sysTid=28752 nice=0 cgrp=default sched=0/0 handle=0x70dfb094f0
| state=R schedstat=( 1351719 2775416 11 ) utm=0 stm=0 core=6 HZ=100
| stack=0x70dfa0e000-0x70dfa10000 stackSize=1009KB
| held mutexes= "mutator lock"(shared held)
native: #00 pc 00000000003c1688 /system/lib64/libart.so (art::DumpNativeStack(std::__1::basic_ostream<char, std::__1::char_traits>&, int, BacktraceMap*, char const*, art::ArtMethod*, void*, bool)+220)
native: #1 pc 000000000048ecf4 /system/lib64/libart.so (art::Thread::DumpStack(std::__1::basic_ostream<char, std::__1::char_traits>&, bool, BacktraceMap*, bool) const+352)
native: #2 pc 00000000002e4bb8 /system/lib64/libart.so (art::JavaVMExt::JniAbort(char const*, char const*)+968)
native: #3 pc 00000000002e4fc8 /system/lib64/libart.so (art::JavaVMExt::JniAbortV(char const*, char const*, std::__va_list)+116)
native: #4 pc 00000000000fcffc /system/lib64/libart.so (art::(anonymous namespace)::ScopedCheck::AbortF(char const*, ...)+148)
native: #5 pc 00000000000fb9d8 /system/lib64/libart.so (art::(anonymous namespace)::ScopedCheck::CheckPossibleHeapValue(art::ScopedObjectAccess&, char, art::(anonymous namespace)::JniValueType)+1152)
.............

Did I miss something?
Thank you

@sufiaji
Copy link
Author

sufiaji commented Apr 18, 2020

Hi team,

Same error when tried to run object detection. App successfully started on my Android device but then few seconds later it crashed with same message:

JNI DETECTED ERROR IN APPLICATION: JNI GetObjectClass called with pending exception java.lang.NoClassDefFoundError: com.google.mediapipe.formats.proto.DetectionProto$Detection
at com.google.protobuf.Parser com.google.mediapipe.formats.proto.DetectionProto$Detection.parser() (DetectionProto.java:2530)
........

This time I didn't change any files related to object detection since the functionality of output stream callback already there.
Thank you.

@sufiaji
Copy link
Author

sufiaji commented Apr 20, 2020

Hi,
I really need your help please... Been working for almost 1 week to solve this issue but no clue :(
Thank you

@sufiaji
Copy link
Author

sufiaji commented Apr 20, 2020

Hi,

Problem solved. Implement protocol buffer full version (not lite) in Gradle solved the issue. Apparently the method being called in GetProtoVector is not exist in protobuf lite version.
Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant