mrousavy / vision-camera-image-labeler

VisionCamera Frame Processor Plugin to label images using MLKit Vision

Home Page:https://github.com/mrousavy/react-native-vision-camera

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Frame Processor threw an error: Exception in HostFunction: java.lang.NoSuchMethodError: no non-static method "Lcom/facebook/react/bridge/ReadableArray;.toArrayList()[Ljava/lang/Object;"

Kypsis opened this issue · comments

On Android Frame Processor threw an error: Exception in HostFunction: java.lang.NoSuchMethodError: no non-static method "Lcom/facebook/react/bridge/ReadableArray;.toArrayList()[Ljava/lang/Object;" is thrown with every tick of the frameProcessor.

Device: Pixel 4a.

Logcat:

2021-08-03 12:16:58.546 13182-13392/com.supervaisor.dashcam.staging E/VisionCamera: Frame Processor threw an error: Exception in HostFunction: java.lang.NoSuchMethodError: no non-static method "Lcom/facebook/react/bridge/ReadableArray;.toArrayList()[Ljava/lang/Object;"
2021-08-03 12:16:58.547 13182-13283/com.supervaisor.dashcam.staging E/ReactNativeJS: Frame Processor threw an error: Exception in HostFunction: java.lang.NoSuchMethodError: no non-static method "Lcom/facebook/react/bridge/ReadableArray;.toArrayList()[Ljava/lang/Object;"
2021-08-03 12:16:58.800 987-987/? W/SoloThreadMana: type=1400 audit(0.0:717094): avc: denied { search } for name="camera" dev="dm-12" ino=209 scontext=u:r:hal_camera_default:s0 tcontext=u:object_r:camera_vendor_data_file:s0 tclass=dir permissive=0
2021-08-03 12:16:58.984 1753-2127/? D/ConnectivityService: NetReassign [no changes]
2021-08-03 12:16:59.000 987-987/? I/chatty: uid=1000(system) provider@2.6-se identical 3 lines
2021-08-03 12:16:59.066 987-987/? W/SoloThreadMana: type=1400 audit(0.0:717098): avc: denied { search } for name="camera" dev="dm-12" ino=209 scontext=u:r:hal_camera_default:s0 tcontext=u:object_r:camera_vendor_data_file:s0 tclass=dir permissive=0
2021-08-03 12:16:59.607 13182-13392/com.supervaisor.dashcam.staging I/HermesVM: JSI rethrowing JS exception: Exception in HostFunction: java.lang.NoSuchMethodError: no non-static method "Lcom/facebook/react/bridge/ReadableArray;.toArrayList()[Ljava/lang/Object;"
    
    Error: Exception in HostFunction: java.lang.NoSuchMethodError: no non-static method "Lcom/facebook/react/bridge/ReadableArray;.toArrayList()[Ljava/lang/Object;"
        at __labelImage (native)
        at labelImage (JavaScript:1:48)
        at labelImage (native)
        at _f (JavaScript:1:77)
        at _f (native)
        at _f (JavaScript:1:425)
        at _f (native)
2021-08-03 12:16:59.608 13182-13392/com.supervaisor.dashcam.staging I/chatty: uid=10390(com.supervaisor.dashcam.staging) pool-22-thread- identical 2 lines
2021-08-03 12:16:59.608 13182-13392/com.supervaisor.dashcam.staging I/HermesVM: JSI rethrowing JS exception: Exception in HostFunction: java.lang.NoSuchMethodError: no non-static method "Lcom/facebook/react/bridge/ReadableArray;.toArrayList()[Ljava/lang/Object;"
    
    Error: Exception in HostFunction: java.lang.NoSuchMethodError: no non-static method "Lcom/facebook/react/bridge/ReadableArray;.toArrayList()[Ljava/lang/Object;"
        at __labelImage (native)
        at labelImage (JavaScript:1:48)
        at labelImage (native)
        at _f (JavaScript:1:77)
        at _f (native)
        at _f (JavaScript:1:425)
        at _f (native)
2021-08-03 12:16:59.609 13182-13392/com.supervaisor.dashcam.staging E/VisionCamera: Frame Processor threw an error: Exception in HostFunction: java.lang.NoSuchMethodError: no non-static method "Lcom/facebook/react/bridge/ReadableArray;.toArrayList()[Ljava/lang/Object;"

Can you test if this change in VisionCamera fixes the issue for you: mrousavy/react-native-vision-camera#322?

You just have to update the two files in your node_modules/react-native-vision-camera/android/src/main/cpp/... directory.

It doesn't throw that bizarre error anymore or crash but now I get (seems to detect things, just not sending back anything):

LOG  [undefined, undefined, undefined]
LOG  [undefined, undefined, undefined, undefined, undefined]
LOG  [undefined, undefined, undefined, undefined]

Logcat:

2021-08-04 13:59:48.468 1003-1096/? D/VSC: @ 507412.171: [WO] orientation angle 0, orientation 0
2021-08-04 13:59:48.976 987-987/? W/SoloThreadMana: type=1400 audit(0.0:897775): avc: denied { search } for name="camera" dev="dm-12" ino=209 scontext=u:r:hal_camera_default:s0 tcontext=u:object_r:camera_vendor_data_file:s0 tclass=dir permissive=0
2021-08-04 13:59:49.076 987-987/? I/chatty: uid=1000(system) provider@2.6-se identical 3 lines
2021-08-04 13:59:49.109 987-987/? W/SoloThreadMana: type=1400 audit(0.0:897779): avc: denied { search } for name="camera" dev="dm-12" ino=209 scontext=u:r:hal_camera_default:s0 tcontext=u:object_r:camera_vendor_data_file:s0 tclass=dir permissive=0
2021-08-04 13:59:49.278 13446-13663/com.supervaisor.dashcam.staging E/VisionCamera: Received unknown JNI type "class java.util.HashMap"! Cannot convert to jsi::Value.
2021-08-04 13:59:49.278 13446-13663/com.supervaisor.dashcam.staging E/VisionCamera: Received unknown JNI type "class java.util.HashMap"! Cannot convert to jsi::Value.
2021-08-04 13:59:49.282 13446-13555/com.supervaisor.dashcam.staging I/ReactNativeJS: [ undefined, undefined ]
2021-08-04 13:59:49.614 1003-1096/? D/CHRE: @ 507413.318: [ActivityPlatform] type 4, confidence 79
2021-08-04 13:59:50.009 987-987/? W/SoloThreadMana: type=1400 audit(0.0:897806): avc: denied { search } for name="camera" dev="dm-12" ino=209 scontext=u:r:hal_camera_default:s0 tcontext=u:object_r:camera_vendor_data_file:s0 tclass=dir permissive=0
2021-08-04 13:59:50.109 987-987/? I/chatty: uid=1000(system) provider@2.6-se identical 3 lines
2021-08-04 13:59:50.142 987-987/? W/SoloThreadMana: type=1400 audit(0.0:897810): avc: denied { search } for name="camera" dev="dm-12" ino=209 scontext=u:r:hal_camera_default:s0 tcontext=u:object_r:camera_vendor_data_file:s0 tclass=dir permissive=0

Checked with the plugin installed in an app and by using the image labeler plugin code in the react-native-vision-camera example.

Oh so another conversion error! JNI is really weird. I can fix that as well hold on

Okay, I didn't test it locally as I'm currently a bit busy, but please let me know if the PR now works (mrousavy/react-native-vision-camera#322)

This works now perfectly on Android. 👍

IOS still has everything being labelled as Metal or Background but that might be iPhone 12 mini thing (had some weird mirroring issues getting CoreML Vision working in the past in native).

I also noticed this! Maybe the frame's orientation is wrong?