expo-notifications in bare workflow

I tried installing expo-notifications ina bare workflow app and I’m able to build the app but when I try to run in my device I get the error:

“Attempt to invoke interface method ‘void.expo.modules.notifications.notifications.interface.NotificationManager.addListener(expo.modules.notifications.notifications.interface.NotificationListener)’ on a null object reference”

Did I miss some thing in the module installation?

Hey, thanks for reporting the issue!

The problem is actually not in expo-notifications, but in invalid react-native-unimodules installation (for some period of time expo eject resulted in a project with a bug that only occurs once you use a more complex module).

To fix it, go to your MainApplication.java and:

  • remove the second argument to ReactModuleRegistryAdapter as shown in this commit (this should work if you have latest react-native-unimodules installed)
  • instead of passing an empty array as the second argument, pass in null (should always work).

Let me know if you encounter any more issues!

3 Likes