mrousavy / react-native-vision-camera

📸 A powerful, high-performance React Native Camera library.
https://react-native-vision-camera.com
MIT License
7.38k stars 1.08k forks source link

🐛 frame-processor/unavailable: Frame Processors are not enabled #560

Closed MadCoderme closed 2 years ago

MadCoderme commented 2 years ago

What were you trying to do?

I was trying to use frame processors. But it almost immediately threw this error

Reproduceable Code

const frameProcessor = useFrameProcessor((frame) => {
        'worklet'
        console.log(frame)
    }, [])

    const devices = useCameraDevices()  
    const device = devices.back
    if (device == null) return <View />
    return (
             <VisionCamera
                 style={{height: height, width: width}}
                 device={device}
                 isActive={true}
                 frameProcessor={frameProcessor}
                 enableZoomGesture
               />
)

What happened instead?

It just doesn't work.

I have react-native-animated setup with version: 2.3.0-beta.2 I am using the latest version of this library

Relevant log output

frame-processor/unavailable: Frame Processors are not enabled. See https://mrousavy.github.io/react-native-vision-camera/docs/guides/troubleshooting, js engine: hermes

Device

Android 11

VisionCamera Version

2.9.3

Additional information

mrousavy commented 2 years ago

Can you share the native Android Logcat logs?

MadCoderme commented 2 years ago

Can you share the native Android Logcat logs?

logcat gave a lot of logs, this is what I extracted from the logs. By the way,This time it said the following in console

Frame Processor threw an error: Exception in HostFunction: Value is undefined, expected an Object

Error: Value is undefined, expected an Object
    at hostFunction (native)

ADB log

10-29 14:20:17.247 18096 18096 F libc    : Fatal signal 6 (SIGABRT), code -1 (SI_QUEUE) in tid 18096 (com.story), pid 18096 (com.story)
10-29 14:20:17.482 18282 18282 F DEBUG   : Process name is com.story, not key_process
10-29 14:20:17.483 18282 18282 F DEBUG   : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
10-29 14:20:17.483 18282 18282 F DEBUG   : Build fingerprint: 'OPPO/CPH2059/OP4C72L1:11/RKQ1.200903.002/1627635836775:user/release-keys'
10-29 14:20:17.483 18282 18282 F DEBUG   : Revision: '0'
10-29 14:20:17.483 18282 18282 F DEBUG   : ABI: 'arm64'
10-29 14:20:17.484 18282 18282 F DEBUG   : Timestamp: 2021-10-29 14:20:17+0600
10-29 14:20:17.484 18282 18282 F DEBUG   : pid: 18096, tid: 18096, name: com.story  >>> com.story <<<
10-29 14:20:17.484 18282 18282 F DEBUG   : uid: 10628
10-29 14:20:17.484 18282 18282 F DEBUG   : signal 6 (SIGABRT), code -1 (SI_QUEUE), fault addr --------
10-29 14:20:17.484 18282 18282 F DEBUG   : Abort message: 'JNI DETECTED ERROR IN APPLICATION: JNI GetObjectRefType called with pending exception java.lang.RuntimeException: Exception in HostFunction: Javascript worklet error
10-29 14:20:17.484 18282 18282 F DEBUG   :
10-29 14:20:17.484 18282 18282 F DEBUG   : Error: Javascript worklet error
10-29 14:20:17.484 18282 18282 F DEBUG   :     at _f (native)
10-29 14:20:17.484 18282 18282 F DEBUG   :
10-29 14:20:17.484 18282 18282 F DEBUG   : Error: Exception in HostFunction: Javascript worklet error
10-29 14:20:17.484 18282 18282 F DEBUG   :
10-29 14:20:17.484 18282 18282 F DEBUG   : Error: Javascript worklet error
10-29 14:20:17.484 18282 18282 F DEBUG   :     at _f (native)
10-29 14:20:17.484 18282 18282 F DEBUG   :     at _f (native)
10-29 14:20:17.484 18282 18282 F DEBUG   :   at void com.swmansion.reanimated.AndroidErrorHandler.raise(java.lang.String) (AndroidErrorHandler.java:6)
10-29 14:20:17.484 18282 18282 F DEBUG   :   at void com.swmansion.reanimated.Scheduler.triggerUI() (Scheduler.java:-2)
10-29 14:20:17.484 18282 18282 F DEBUG   :   at void com.swmansion.reanimated.Scheduler$1.run() (Scheduler.java:23)
10-29 14:20:17.484 18282 18282 F DEBUG   :   at void com.swmansion.reanimated.Scheduler$2.runGuarded() (Scheduler.java:41)
10-29 14:20:17.484 18282 18282 F DEBUG   :   at void com.facebook.react.bridge.GuardedRunnable.run() (GuardedRunnable.java:31)
10-29 14:20:17.484 18282 18282 F DEBUG   :   at void android.os.Handler.handleCallback(android.os.Message) (Handler.java:938)
10-29 14:20:17.484 18282 18282 F DEBUG   :   at void android.os.Handler.dispatchMessage(android.os.Message) (Handler.java:99)
10-29 14:20:17.484 18282 18282 F DEBUG   :   at void android.os.Looper.loop() (Looper.java:263)
10-29 14:20:17.484 18282 18282 F DEBUG   :   at void android.app.ActivityThread.main(java.lang.String[]) (ActivityThread.java:8246)
10-29 14:20:17.484 18282 18282 F DEBUG   :   at java.lang.Object java.lang.reflect.Method.invoke(java.lang.Object, java.lang.Object[]) (Method.java:-2)
10-29 14:20:17.484 18282 18282 F DEBUG   :   at void com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run() (RuntimeInit.java:612)
10-29 14:20:17.484 18282 18282 F DEBUG   :   at void com.android.internal.os.ZygoteInit.main(java.lang.String[]) (ZygoteInit.java:1006)
10-29 14:20:17.484 18282 18282 F DEBUG   :
10-29 14:20:17.484 18282 18282 F DEBUG   :     in call to GetObjectRefType
10-29 14:20:17.484 18282 18282 F DEBUG   :     from void com.swmansion.reanimated.Scheduler.triggerUI()'
10-29 14:20:17.484 18282 18282 F DEBUG   :     x0  0000000000000000  x1  00000000000046b0  x2  0000000000000006  x3  0000007fe04c9af0
10-29 14:20:17.484 18282 18282 F DEBUG   :     x4  0000007de1092000  x5  0000007de1092000  x6  0000007de1092000  x7  0000000040a6c000
10-29 14:20:17.484 18282 18282 F DEBUG   :     x8  00000000000000f0  x9  3e2d07f05c11b3d3  x10 0000000000000000  x11 ffffffc0fffffbdf
10-29 14:20:17.484 18282 18282 F DEBUG   :     x12 0000000000000001  x13 000000000000074e  x14 0000007dd9fad9e2  x15 aaaaaaaaaaaaaaab
10-29 14:20:17.484 18282 18282 F DEBUG   :     x16 0000007dd9faa7e0  x17 0000007dd9f89da0  x18 0000007de0198000  x19 00000000000046b0
10-29 14:20:17.484 18282 18282 F DEBUG   :     x20 00000000000046b0  x21 00000000ffffffff  x22 0000000000000000  x23 0000000000000000
10-29 14:20:17.484 18282 18282 F DEBUG   :     x24 0000007d574180b7  x25 0000000000000001  x26 0000007d5742f098  x27 0000007d57a34000
10-29 14:20:17.484 18282 18282 F DEBUG   :     x28 b400007d5992d460  x29 0000007fe04c9b70
10-29 14:20:17.484 18282 18282 F DEBUG   :     lr  0000007dd9f3d460  sp  0000007fe04c9ad0  pc  0000007dd9f3d48c  pst 0000000000000000
10-29 14:20:17.489 18282 18282 F DEBUG   : backtrace:
10-29 14:20:17.489 18282 18282 F DEBUG   :     NOTE: Function names and BuildId information is missing for some frames due
10-29 14:20:17.489 18282 18282 F DEBUG   :     NOTE: to unreadable libraries. For unwinds of apps, only shared libraries
10-29 14:20:17.489 18282 18282 F DEBUG   :     NOTE: found under the lib/ directory are readable.
10-29 14:20:17.489 18282 18282 F DEBUG   :       #00 pc 000000000007848c  /apex/com.android.runtime/lib64/bionic/libc.so (abort+164) (BuildId: 1ca28d785d6567d2b225cf978ef04de5)
10-29 14:20:17.490 18282 18282 F DEBUG   :       #01 pc 000000000055dbf4  /apex/com.android.art/lib64/libart.so (art::Runtime::Abort(char const*)+2308) (BuildId: 55ad887cb7f73378c6e49388f887d60a)
10-29 14:20:17.490 18282 18282 F DEBUG   :       #02 pc 0000000000013988  /system/lib64/libbase.so (android::base::SetAborter(std::__1::function<void (char const*)>&&)::$_3::__invoke(char const*)+76) (BuildId: a09a41f1c2370328c811e735cdaa2860)
10-29 14:20:17.490 18282 18282 F DEBUG   :       #03 pc 0000000000012fb4  /system/lib64/libbase.so (android::base::LogMessage::~LogMessage()+320) 
(BuildId: a09a41f1c2370328c811e735cdaa2860)
10-29 14:20:17.490 18282 18282 F DEBUG   :       #04 pc 000000000038568c  /apex/com.android.art/lib64/libart.so (art::JavaVMExt::JniAbort(char const*, char const*)+2572) (BuildId: 55ad887cb7f73378c6e49388f887d60a)
10-29 14:20:17.490 18282 18282 F DEBUG   :       #05 pc 0000000000385704  /apex/com.android.art/lib64/libart.so (art::JavaVMExt::JniAbortV(char const*, char const*, std::__va_list)+108) (BuildId: 55ad887cb7f73378c6e49388f887d60a)
10-29 14:20:17.490 18282 18282 F DEBUG   :       #06 pc 00000000003773e8  /apex/com.android.art/lib64/libart.so (art::(anonymous namespace)::ScopedCheck::AbortF(char const*, ...)+144) (BuildId: 55ad887cb7f73378c6e49388f887d60a)
10-29 14:20:17.490 18282 18282 F DEBUG   :       #07 pc 0000000000375f00  /apex/com.android.art/lib64/libart.so (art::(anonymous namespace)::ScopedCheck::CheckPossibleHeapValue(art::ScopedObjectAccess&, char, art::(anonymous namespace)::JniValueType)+3108) (BuildId: 55ad887cb7f73378c6e49388f887d60a)
10-29 14:20:17.490 18282 18282 F DEBUG   :       #08 pc 0000000000374b60  /apex/com.android.art/lib64/libart.so (art::(anonymous namespace)::ScopedCheck::Check(art::ScopedObjectAccess&, bool, char const*, art::(anonymous namespace)::JniValueType*)+612) (BuildId: 55ad887cb7f73378c6e49388f887d60a)
10-29 14:20:17.490 18282 18282 F DEBUG   :       #09 pc 0000000000374238  /apex/com.android.art/lib64/libart.so (art::(anonymous namespace)::CheckJNI::GetObjectRefType(_JNIEnv*, _jobject*)+692) (BuildId: 55ad887cb7f73378c6e49388f887d60a)
10-29 14:20:17.490 18282 18282 F DEBUG   :       #10 pc 0000000000019098  /data/data/com.story/lib-main/libfbjni.so
10-29 14:20:17.490 18282 18282 F DEBUG   :       #11 pc 000000000013ab58  /data/app/~~K4QpMmlLc8tWkKA8SNuRSQ==/com.story-qrDfA9tL4kgV3tLCoMnk8g==/base.apk!libreanimated.so (offset 0x3aef000) (facebook::jni::LocalReferenceAllocator::verifyReference(_jobject*) const+32) (BuildId: e63d64f65feb02489381572bde935878cd1b3504)
10-29 14:20:17.490 18282 18282 F DEBUG   :       #12 pc 000000000013abd0  /data/app/~~K4QpMmlLc8tWkKA8SNuRSQ==/com.story-qrDfA9tL4kgV3tLCoMnk8g==/base.apk!libreanimated.so (offset 0x3aef000) (facebook::jni::LocalReferenceAllocator::deleteReference(_jobject*) const+80) (BuildId: e63d64f65feb02489381572bde935878cd1b3504)
10-29 14:20:17.490 18282 18282 F DEBUG   :       #13 pc 000000000013ab18  /data/app/~~K4QpMmlLc8tWkKA8SNuRSQ==/com.story-qrDfA9tL4kgV3tLCoMnk8g==/base.apk!libreanimated.so (offset 0x3aef000) (facebook::jni::base_owned_ref<facebook::jni::JString, facebook::jni::LocalReferenceAllocator>::reset(_jstring*)+144) (BuildId: e63d64f65feb02489381572bde935878cd1b3504)
10-29 14:20:17.490 18282 18282 F DEBUG   :       #14 pc 000000000013aa60  /data/app/~~K4QpMmlLc8tWkKA8SNuRSQ==/com.story-qrDfA9tL4kgV3tLCoMnk8g==/base.apk!libreanimated.so (offset 0x3aef000) (facebook::jni::base_owned_ref<facebook::jni::JString, facebook::jni::LocalReferenceAllocator>::reset()+28) (BuildId: e63d64f65feb02489381572bde935878cd1b3504)
--------- beginning of system
10-29 14:21:00.014  1810  5671 I chatty  : uid=1000(system) Binder:1810_18 expire 1 line
10-29 14:21:00.016  1810  5670 I chatty  : uid=1000(system) Binder:1810_17 expire 1 line
10-29 14:21:00.514  1810  2526 I chatty  : uid=1000(system) PowerManagerSer expire 140 lines
10-29 14:21:00.735  1810  1810 I chatty  : uid=1000(system) Binder:1810_3 expire 5 lines
10-29 14:21:00.930  1810 16161 I chatty  : uid=1000(system) HwBinder:1810_4 expire 3 lines
10-29 14:21:04.737  1810  3177 I chatty  : uid=1000(system) temperatureProv expire 1 line
10-29 14:21:13.382  1810  2204 I chatty  : uid=1000(system) watchdog expire 1 line
10-29 14:21:14.629  1810  2526 I chatty  : uid=1000(system) PowerManagerSer expire 111 lines
10-29 14:21:14.744  1810  3177 I chatty  : uid=1000(system) temperatureProv expire 2 lines
10-29 14:21:17.084  1810 16161 I chatty  : uid=1000(system) HwBinder:1810_4 expire 1 line
10-29 14:21:18.866  3533  3533 D ColorViewRootUtil: initSwipState, isDisplayCompatApp false
10-29 14:21:18.867  3533  3533 D ColorViewRootUtil: mScreenHeight 2400, mScreenWidth 1080
10-29 14:21:18.890  1810  2200 I chatty  : uid=1000(system) android.display expire 14 lines
10-29 14:21:19.291  1810  5728 I chatty  : uid=1000(system) Binder:1810_1C expire 1 line
10-29 14:21:19.353  1810 13498 I chatty  : uid=1000(system) ColorScreenOffT expire 2 lines
10-29 14:21:19.353  1810  3185 I chatty  : uid=1000(system) TorchManagerSer expire 3 lines
10-29 14:21:19.364  1810  1810 I chatty  : uid=1000(system) Binder:1810_3 expire 4 lines
10-29 14:21:19.368  1810  1924 I chatty  : uid=1000(system) Binder:1810_1 expire 3 lines
10-29 14:21:19.407  1810  5810 I chatty  : uid=1000(system) Binder:1810_21 expire 1 line
10-29 14:21:22.194  1810  2679 I chatty  : uid=1000(system) Thread-7 expire 1 line
10-29 14:21:22.194  1810  2356 I chatty  : uid=1000(system) batterystats-wo expire 1 line
10-29 14:21:23.642  1810  3171 I chatty  : uid=1000(system) OplusJobSchedul expire 12 lines
10-29 14:21:25.823  1810  2526 I chatty  : uid=1000(system) PowerManagerSer expire 73 lines
10-29 14:21:25.863  1810  5670 I chatty  : uid=1000(system) Binder:1810_17 expire 4 lines
10-29 14:21:25.864  1810  2266 I chatty  : uid=1000(system) ActivityManager expire 2 lines
10-29 14:21:25.880  1810  1924 I chatty  : uid=1000(system) Binder:1810_1 expire 22 lines
10-29 14:21:26.848  1810  3142 I chatty  : uid=1000(system) ConnectivitySer expire 1 line
10-29 14:21:28.073  1810  2679 I chatty  : uid=1000(system) Thread-7 expire 1 line
10-29 14:21:28.163  1810  3253 I chatty  : uid=1000(system) PhotonicModulat expire 39 lines
10-29 14:21:28.300  1810  2200 I chatty  : uid=1000(system) android.display expire 2 lines
10-29 14:21:30.052 18304 18304 D ViewRootImpl: enqueueInputEventMotionEvent { action=ACTION_DOWN, actionButton=0, id[0]=0, x[0]=1057.0, y[0]=689.0, toolType[0]=TOOL_TYPE_FINGER, buttonState=0, classification=NONE, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=0, eventTime=2446656972, downTime=2446656972, deviceId=3, source=0x1002, displayId=0 }
10-29 14:21:30.165  1810  2526 I chatty  : uid=1000(system) PowerManagerSer expire 129 lines
10-29 14:21:30.185  1810  3253 I chatty  : uid=1000(system) PhotonicModulat expire 9 lines
10-29 14:21:31.870  1810  1810 I chatty  : uid=1000(system) Binder:1810_3 expire 5 lines
10-29 14:21:32.956  1810  2679 I chatty  : uid=1000(system) Thread-7 expire 2 lines
10-29 14:21:34.753  1810  3177 I chatty  : uid=1000(system) temperatureProv expire 3 lines
10-29 14:21:42.163  1810  2526 I chatty  : uid=1000(system) PowerManagerSer expire 131 lines
10-29 14:21:43.174  1810  2679 I chatty  : uid=1000(system) Thread-7 expire 3 lines
10-29 14:21:43.174  1810  1810 I chatty  : uid=1000(system) Binder:1810_3 expire 6 lines
10-29 14:21:43.383  1810  2204 I chatty  : uid=1000(system) watchdog expire 1 line
10-29 14:21:55.376  1810  2526 I chatty  : uid=1000(system) PowerManagerSer expire 109 lines
10-29 14:21:57.868  1810  1810 I chatty  : uid=1000(system) Binder:1810_3 expire 10 lines
10-29 14:22:00.041  1810  5810 I chatty  : uid=1000(system) Binder:1810_21 expire 4 lines
10-29 14:22:00.047  1810  4215 I chatty  : uid=1000(system) Binder:1810_C expire 3 lines
10-29 14:22:00.064  1810  2679 I chatty  : uid=1000(system) Thread-7 expire 2 lines
10-29 14:22:04.304  3533  3533 D ColorViewRootUtil: initSwipState, isDisplayCompatApp false
10-29 14:22:04.304  3533  3533 D ColorViewRootUtil: mScreenHeight 2400, mScreenWidth 1080
10-29 14:22:04.335  1810  2200 I chatty  : uid=1000(system) android.display expire 9 lines
10-29 14:22:04.781  1810  3177 I chatty  : uid=1000(system) temperatureProv expire 1 line
10-29 14:22:04.827  1810 13498 I chatty  : uid=1000(system) ColorScreenOffT expire 2 lines
10-29 14:22:04.828  1810  3185 I chatty  : uid=1000(system) TorchManagerSer expire 3 lines
10-29 14:22:04.866  1810  5726 I chatty  : uid=1000(system) Binder:1810_1B expire 11 lines
10-29 14:22:06.316  1810  2200 I chatty  : uid=1000(system) android.display expire 28 lines
10-29 14:22:06.316  1810  5810 I chatty  : uid=1000(system) Binder:1810_21 expire 11 lines
10-29 14:22:06.369  1810  2526 I chatty  : uid=1000(system) PowerManagerSer expire 31 lines
MadCoderme commented 2 years ago

The issue was resolved surprisingly. I honestly did nothing but cleared cache and reinstalled app a few times. But still this is interesting, why this happened?

My guess is the react-native-reanimated babel plugin was not being setup correctly although i had added it. I am closing this issue here

mrousavy commented 2 years ago

Weird. Nice that it works now though! The android SIGABRT crash looks like a reanimated crash though.

MadCoderme commented 2 years ago

Yeah, it was really weird, i have been on this for two days, finally! It is a really great feature dude. You are a superb developer :D

pnadj commented 2 years ago

Having same issue

valn1 commented 1 year ago

I am having this issue in ios

"react": "18.1.0", "react-native": "^0.70.0", "react-native-reanimated": "2.10.0", "react-native-vision-camera": "2.14.1", "vision-camera-code-scanner": "^0.2.0"

platform :ios, '12.4'

i tried everything in this link but to no success https://mrousavy.com/react-native-vision-camera/docs/guides/troubleshooting/

could someone help me understand why this is happening so i can figure out a way to fix it?

anuj2285 commented 1 year ago

npm i react-native-reanimated It worked for me!