react-native-background-fetch: App crashes : RNBackgroundFetch.configure got 2 arguments, expected 3

Your Environment

  • Plugin version:4.1.1
  • Platform: Android
  • OS version:Android 10 and above
  • Device manufacturer / model:One plus
  • React Native version (react-native -v):0.63.2
  • Plugin config { minimumFetchInterval: 30, // <-- minutes ( minimum allowed) // Android options forceAlarmManager: true, // <-- Set true to bypass JobScheduler. stopOnTerminate: false, startOnBoot: true, enableHeadless: true, // periodic:false, requiredNetworkType: BackgroundFetch.NETWORK_TYPE_ANY, // Default requiresCharging: false, // Default requiresDeviceIdle: false, // Default requiresBatteryNotLow: false, // Default requiresStorageNotLow: false // Default },

Expected Behavior

App should not crash on start

Actual Behavior

App is crashing after splashscreen

Steps to Reproduce

Context

i was trying build apk and run it in diff devices

Debug logs

2022-12-22 00:47:13.253 13374-13374/? E/sa.smartcontro: Unknown bits set in runtime_flags: 0x28000 2022-12-22 00:47:14.199 13374-15908/ae.adafsa.smartcontrol E/unknown:ReactNative: ReactInstanceManager.createReactContext: mJSIModulePackage null 2022-12-22 00:47:14.199 13374-15921/ae.adafsa.smartcontrol E/ReactNativeJNI: logMarker CREATE_REACT_CONTEXT_END 2022-12-22 00:47:14.227 13374-15921/ae.adafsa.smartcontrol E/ReactNativeJNI: logMarker RUN_JS_BUNDLE_START 2022-12-22 00:47:14.228 13374-15922/ae.adafsa.smartcontrol E/unknown:ReactNative: ReactInstanceManager.attachRootViewToInstance() 2022-12-22 00:47:14.485 13374-15922/ae.adafsa.smartcontrol E/unknown:ReactRootView: runApplication: call AppRegistry.runApplication 2022-12-22 00:47:14.656 13374-13374/ae.adafsa.smartcontrol E/unknown:ReactNative: Unable to launch logbox because react was unable to create the root view 2022-12-22 00:47:15.681 13374-13374/ae.adafsa.smartcontrol E/libc: Access denied finding property “ro.serialno” 2022-12-22 00:47:16.551 13374-15921/ae.adafsa.smartcontrol E/ReactNativeJNI: logMarker RUN_JS_BUNDLE_END 2022-12-22 00:47:16.836 13374-15922/ae.adafsa.smartcontrol E/unknown:ReactNative: CatalystInstanceImpl caught native exception com.facebook.react.bridge.NativeArgumentsParseException: RNBackgroundFetch.configure got 2 arguments, expected 3 at com.facebook.react.bridge.JavaMethodWrapper.invoke(JavaMethodWrapper.java:349) at com.facebook.react.bridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:151) at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method) at android.os.Handler.handleCallback(Handler.java:883) at android.os.Handler.dispatchMessage(Handler.java:100) at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:27) at android.os.Looper.loop(Looper.java:214) at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(MessageQueueThreadImpl.java:226) at java.lang.Thread.run(Thread.java:919) 2022-12-22 00:47:16.837 13374-15922/ae.adafsa.smartcontrol E/unknown:DisabledDevSupportManager: Caught exception com.facebook.react.bridge.NativeArgumentsParseException: RNBackgroundFetch.configure got 2 arguments, expected 3 at com.facebook.react.bridge.JavaMethodWrapper.invoke(JavaMethodWrapper.java:349) at com.facebook.react.bridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:151) at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method) at android.os.Handler.handleCallback(Handler.java:883) at android.os.Handler.dispatchMessage(Handler.java:100) at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:27) at android.os.Looper.loop(Looper.java:214) at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(MessageQueueThreadImpl.java:226) at java.lang.Thread.run(Thread.java:919)

--------- beginning of crash

2022-12-22 00:47:16.837 13374-15922/ae.adafsa.smartcontrol E/AndroidRuntime: FATAL EXCEPTION: mqt_native_modules Process: ae.adafsa.smartcontrol, PID: 13374 com.facebook.react.bridge.NativeArgumentsParseException: RNBackgroundFetch.configure got 2 arguments, expected 3 at com.facebook.react.bridge.JavaMethodWrapper.invoke(JavaMethodWrapper.java:349) at com.facebook.react.bridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:151) at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method) at android.os.Handler.handleCallback(Handler.java:883) at android.os.Handler.dispatchMessage(Handler.java:100) at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:27) at android.os.Looper.loop(Looper.java:214) at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(MessageQueueThreadImpl.java:226) at java.lang.Thread.run(Thread.java:919)

About this issue

  • Original URL
  • State: open
  • Created 2 years ago
  • Reactions: 1
  • Comments: 15 (8 by maintainers)

Most upvoted comments

It can also be be caused by a developer updating from a very old version of the plugin (from when .configure used to accept 2 Args; before the onTimeout callback was added) without reviewing the api docs in the readme, which clearly states that 3 args are required.

This is why I want to see what args are being provided to .configure — are there 2 or 3?

I suggest you remove the plugin and get your app to boot without the plugin.

then re-add it.