mediapipe icon indicating copy to clipboard operation
mediapipe copied to clipboard

Android Hand Tracking App With "null pointer dereference"

Open TrifaC opened this issue 3 years ago • 0 comments

Background

I created an Android app with hand tracking function which uses the aar library. The app works fine with the hand detection function but it crashes when I try to build it with hand tracking function.

Github Link: https://github.com/TrifaC/MediaPipeHandTest.git

System information

  • Check the github link above which contain the example code.
  • OS Platform: Linux 20.04.
  • Mobile device: HUAWEI Mate 9 Harmony OS, Samsung S10 Android 12
  • Programming Language and version ( e.g. C++, Python, Java): Kotlin
  • MediaPipe version: v0.8.10.2
  • Bazel version (if compiling from source): bazel 5.2.0
  • Solution ( e.g. FaceMesh, Pose, Holistic ): HandTracking
  • Android Studio, NDK, SDK versions (if issue is related to building in Android environment):
    • compileSdk 32
    • minSdk 21
    • tartgetSdk 27

Describe the current behavior: The error signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0 appears when I run my Android App, after that the app is crashed.

Describe the expected behavior: The app can run perfectly when I change the arr to hand detection function. It can detect my hand. Also the code can run the pose detection function with mediapipe aar library.

Standalone code to reproduce the issue:

I am not sure about the code whether the following code relates to the problem or not. However, the problem appears when I added the side packet related code.

In the MainActivity (Line 143 to Line 146):

val packetCreator: AndroidPacketCreator = processor!!.packetCreator
val inputSidePackets: MutableMap<String, Packet> = mutableMapOf<String, Packet>()
inputSidePackets[INPUT_NUM_HANDS_SIDE_PACKET_NAME] = packetCreator.createInt32(NUM_HANDS)
processor!!.setInputSidePackets(inputSidePackets)

Other info / Complete Logs :

2022-08-10 11:44:58.354 29880-29880/? A/DEBUG: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
2022-08-10 11:44:58.355 29880-29880/? A/DEBUG: Build fingerprint: 'HUAWEI/MHA-AL00/HWMHA:9/HUAWEIMHA-AL00/9.1.0.228C00:user/release-keys'
2022-08-10 11:44:58.355 29880-29880/? A/DEBUG: Revision: '0'
2022-08-10 11:44:58.355 29880-29880/? A/DEBUG: ABI: 'arm64'
2022-08-10 11:44:58.355 29880-29880/? A/DEBUG: Happend: 'Wed Aug 10 11:44:58 2022
    '
2022-08-10 11:44:58.356 29880-29880/? A/DEBUG: SYSVMTYPE: Art
    APPVMTYPE: Art
2022-08-10 11:44:58.356 29880-29880/? A/DEBUG: pid: 29741, tid: 29862, name: Thread-14  >>> com.example.mediapipehandtest <<<
2022-08-10 11:44:58.356 29880-29880/? A/DEBUG: signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0
2022-08-10 11:44:58.356 29880-29880/? A/DEBUG: Cause: null pointer dereference
2022-08-10 11:44:58.356 29880-29880/? A/DEBUG:     x0  0000000000000000  x1  0000007d716484d0  x2  0000007d71600000  x3  0000000000000003
2022-08-10 11:44:58.356 29880-29880/? A/DEBUG:     x4  0000000000000000  x5  0000007d5bdf1a8c  x6  645f746573736126  x7  6c756f6329617461
2022-08-10 11:44:58.356 29880-29880/? A/DEBUG:     x8  0101010101010101  x9  0000007fcc3fbb78  x10 000000000000000b  x11 00000000fffffff5
2022-08-10 11:44:58.356 29880-29880/? A/DEBUG:     x12 0000000000000041  x13 00000000fffffff5  x14 0000007d703cdfb5  x15 0000000000000054
2022-08-10 11:44:58.356 29880-29880/? A/DEBUG:     x16 0000007d706589e8  x17 0000007e10e608d0  x18 0000000000000001  x19 0000007d5dc030d8
2022-08-10 11:44:58.356 29880-29880/? A/DEBUG:     x20 0000007d5a451680  x21 0000000000000000  x22 ffffffffffffffff  x23 0000007d5dc02f40
2022-08-10 11:44:58.356 29880-29880/? A/DEBUG:     x24 0000007d5d417f00  x25 0000000000000030  x26 0000007d5dc03588  x27 0000000000000000
2022-08-10 11:44:58.356 29880-29880/? A/DEBUG:     x28 0000007d70660ab0  x29 0000007d5dc034b0
2022-08-10 11:44:58.356 29880-29880/? A/DEBUG:     sp  0000007d5dc02f30  lr  0000007d6ff06780  pc  0000007e10e608e0
2022-08-10 11:44:58.360 29880-29880/? A/DEBUG: backtrace:
2022-08-10 11:44:58.360 29880-29880/? A/DEBUG:     #00 pc 000000000001e8e0  /system/lib64/libc.so (strlen+16)
2022-08-10 11:44:58.360 29880-29880/? A/DEBUG:     #01 pc 000000000017277c  /data/app/com.example.mediapipehandtest-PwxOgx-2FpmanVB_fdM4Gg==/lib/arm64/libmediapipe_jni.so
2022-08-10 11:44:58.360 29880-29880/? A/DEBUG:     #02 pc 0000000000108638  /data/app/com.example.mediapipehandtest-PwxOgx-2FpmanVB_fdM4Gg==/lib/arm64/libmediapipe_jni.so
2022-08-10 11:44:58.360 29880-29880/? A/DEBUG:     #03 pc 00000000004dbb4c  /data/app/com.example.mediapipehandtest-PwxOgx-2FpmanVB_fdM4Gg==/lib/arm64/libmediapipe_jni.so
2022-08-10 11:44:58.360 29880-29880/? A/DEBUG:     #04 pc 00000000004cd804  /data/app/com.example.mediapipehandtest-PwxOgx-2FpmanVB_fdM4Gg==/lib/arm64/libmediapipe_jni.so
2022-08-10 11:44:58.360 29880-29880/? A/DEBUG:     #05 pc 00000000004cd680  /data/app/com.example.mediapipehandtest-PwxOgx-2FpmanVB_fdM4Gg==/lib/arm64/libmediapipe_jni.so
2022-08-10 11:44:58.360 29880-29880/? A/DEBUG:     #06 pc 00000000004f09f0  /data/app/com.example.mediapipehandtest-PwxOgx-2FpmanVB_fdM4Gg==/lib/arm64/libmediapipe_jni.so
2022-08-10 11:44:58.360 29880-29880/? A/DEBUG:     #07 pc 00000000004f0758  /data/app/com.example.mediapipehandtest-PwxOgx-2FpmanVB_fdM4Gg==/lib/arm64/libmediapipe_jni.so
2022-08-10 11:44:58.360 29880-29880/? A/DEBUG:     #08 pc 0000000000083b28  /system/lib64/libc.so (__pthread_start(void*)+36)
2022-08-10 11:44:58.361 29880-29880/? A/DEBUG:     #09 pc 0000000000024724  /system/lib64/libc.so (__start_thread+68)
2022-08-10 11:44:58.361 887-29853/? E/IppAlgoSmartAE: [67ae1260_64E] doSmartAEAlgo() failed to getSceneMode

TrifaC avatar Aug 10 '22 07:08 TrifaC

Are you satisfied with the resolution of your issue? Yes No

google-ml-butler[bot] avatar Aug 12 '22 02:08 google-ml-butler[bot]

I have the same problem

leos-code avatar Aug 24 '22 08:08 leos-code

hope can open issue

leos-code avatar Aug 24 '22 08:08 leos-code

hope can open issue

I have fix the problem. The error happens because the resource file in the "assert" package is missing.

TrifaC avatar Aug 25 '22 05:08 TrifaC