0

Every time that I import RtcEngine into my application (import RtcEngine from 'react-native-agora';) I get the following error:

TypeError: null is not an object (evaluating 'AgoraRtcChannelModule.prefix')
at node_modules\react-native\Libraries\LogBox\LogBox.js:148:8 in registerError
at node_modules\react-native\Libraries\LogBox\LogBox.js:59:8 in errorImpl
at node_modules\react-native\Libraries\LogBox\LogBox.js:33:4 in console.error
at node_modules\expo\build\environment\react-native-logs.fx.js:27:4 in error
at node_modules\react-native\Libraries\Core\ExceptionsManager.js:104:6 in reportException
at node_modules\react-native\Libraries\Core\ExceptionsManager.js:171:19 in handleException
at node_modules\react-native\Libraries\Core\setUpErrorHandling.js:24:6 in handleError
at node_modules\expo-error-recovery\build\ErrorRecovery.fx.js:12:21 in ErrorUtils.setGlobalHandler$argument_0
at node_modules\@babel\runtime\node_modules\regenerator-runtime\runtime.js:62:36 in tryCatch
at node_modules\@babel\runtime\node_modules\regenerator-runtime\runtime.js:288:29 in invoke
at node_modules\@babel\runtime\node_modules\regenerator-runtime\runtime.js:62:36 in tryCatch
at node_modules\@babel\runtime\node_modules\regenerator-runtime\runtime.js:152:27 in invoke
at node_modules\@babel\runtime\node_modules\regenerator-runtime\runtime.js:162:18 in Promise.resolve.then$argument_0
at node_modules\react-native\node_modules\promise\setimmediate\core.js:37:13 in tryCallOne
at node_modules\react-native\node_modules\promise\setimmediate\core.js:123:24 in setImmediate$argument_0
at node_modules\react-native\Libraries\Core\Timers\JSTimers.js:130:14 in _callTimer
at node_modules\react-native\Libraries\Core\Timers\JSTimers.js:181:14 in _callImmediatesPass
at node_modules\react-native\Libraries\Core\Timers\JSTimers.js:441:30 in callImmediates
at node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:387:6 in __callImmediates
at node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:135:6 in __guard$argument_0
at node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:364:10 in __guard
at node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:134:4 in flushedQueue
at [native code]:null in flushedQueue
at [native code]:null in invokeCallbackAndReturnFlushedQueue

Invariant Violation: "main" has not been registered. This can happen if:
* Metro (the local dev server) is run from the wrong folder. Check if Metro is running, stop it and restart it in the current project.
* A module failed to load due to an error and `AppRegistry.registerComponent` wasn't called.
at node_modules\react-native\Libraries\LogBox\LogBox.js:148:8 in registerError
at node_modules\react-native\Libraries\LogBox\LogBox.js:59:8 in errorImpl
at node_modules\react-native\Libraries\LogBox\LogBox.js:33:4 in console.error
at node_modules\expo\build\environment\react-native-logs.fx.js:27:4 in error
at node_modules\react-native\Libraries\Core\ExceptionsManager.js:104:6 in reportException
at node_modules\react-native\Libraries\Core\ExceptionsManager.js:171:19 in handleException
at node_modules\react-native\Libraries\Core\setUpErrorHandling.js:24:6 in handleError
at node_modules\expo-error-recovery\build\ErrorRecovery.fx.js:12:21 in ErrorUtils.setGlobalHandler$argument_0
at node_modules\@babel\runtime\node_modules\regenerator-runtime\runtime.js:62:36 in tryCatch
at node_modules\@babel\runtime\node_modules\regenerator-runtime\runtime.js:288:29 in invoke
at node_modules\@babel\runtime\node_modules\regenerator-runtime\runtime.js:62:36 in tryCatch
at node_modules\@babel\runtime\node_modules\regenerator-runtime\runtime.js:152:27 in invoke
at node_modules\@babel\runtime\node_modules\regenerator-runtime\runtime.js:162:18 in Promise.resolve.then$argument_0
at node_modules\react-native\node_modules\promise\setimmediate\core.js:37:13 in tryCallOne
at node_modules\react-native\node_modules\promise\setimmediate\core.js:123:24 in setImmediate$argument_0
at node_modules\react-native\Libraries\Core\Timers\JSTimers.js:130:14 in _callTimer
at node_modules\react-native\Libraries\Core\Timers\JSTimers.js:181:14 in _callImmediatesPass
at node_modules\react-native\Libraries\Core\Timers\JSTimers.js:441:30 in callImmediates
at node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:387:6 in __callImmediates
at node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:135:6 in __guard$argument_0
at node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:364:10 in __guard
at node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:134:4 in flushedQueue
at [native code]:null in flushedQueue
at [native code]:null in invokeCallbackAndReturnFlushedQueue

Note: this is without any calls.

Any help on this would be greatly appreciated. I am fairly new to react-native and javascript so I hope I have provided enough information.

2 Answers 2

2

Update:
Expo now supports using native modules without ejecting to the bare wofklow with the use of custom development clients, you can learn more about using them with Agora here.

After setting up custom development clients, run your app using expo run:ios or expo run:android.

4
  • Hi, i am using this "agora-react-native-rtm" package and I am also getting the same error Jul 6, 2022 at 14:03
  • After setting up custom development clients, run your app using expo run:ios or expo run:android. Jul 7, 2022 at 7:21
  • I am not using expo, I am using react native cli, I used their example and after fixing many bugs I was able to run it but when I tried the same code in my other project I started getting this error. And after checking the code in a package this prefix is coming from native library code written in an android folder and I think this prefix is not coming. I don't know why it is not coming. maybe We have to add something in an android folder, I am sure what is wrong. Jul 9, 2022 at 11:18
  • this prefix is a variable in the agora package and the value is coming from native code. It's working in one and not working. Jul 9, 2022 at 11:24
1

I think you're not using React Native properly.

I'd probably suggest reading the docs and trying the latest version:

P.S: Agora React-Native SDK doesn't support Expo.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.