Expo SDK: 41
Workflow: managed
Platform: Android ONLY
So my app is crashing on Android with the following native error:
java.lang.NullPointerException: Attempt to invoke virtual method 'void com.rollbar.android.Rollbar.configure(com.rollbar.notifier.config.ConfigProvider)' on a null object reference
This ONLY happens with packages built with eas build, and ONLY on Android, iOS works fine.
And if I install the app built from expo build, then it works fine for both platforms.
Anyone has any insights or experience something similar?
Update: I removed rollbar-react-native references from my code ran another eas build again & it worked, so this definitely has something to do with EAS build & rollbar-react-native package for Android.
This is the code where Rollbar is initialized
So yeah, I did test with both expo build & eas build, for the app built with expo build, it works totally fine as expected.
Oh one more thing I just noticed today thatās relevant, on Android, the UI even look different comparing the expo build app vs eas build app (see below)
could you share how you adding RollbarReactNative.init() in MainApplication? because for managed workflow app, assuming there is no any native code like MainApplication.java.
Hi, Iām using Expo managed workflow so I didnāt change any native code at all, but this is the package I was using, and I basically just followed their doc here
"rollbar-react-native": "^0.9.2",
and here is how I initialize it in React Native code
hi there!
after taking some time to setup a rollbar project, i found that is an interesting case.
rollbar-react-native sdk can support if native module does not exist.
for expo build, native modules are not supported and make rollbar-react-native works in pure js environment. on the other hand, eas build supports native modules and breaks rollbar-react-native sdk.
a workaround in the meantime is to exclude rollbar-react-native from autolinking by adding react-native.config.js file like this.
however, still suggest to use config plugin for adding RollbarReactNative.init() in MainApplication. that would benefit full functionalities from rollbar sdk.
Thank you SO much for providing a solution & explanation! I get it now!!!
That said, because we donāt have any Native app developers, we are probably only gonna try the react-native.config.js approach and will report back here for the findings
Last but not least, Iām still curious as to why rollbar-react-native built with eas build worked on iOS but not Android tho? Did the linking only worked for iOS or something?
Hi @kudochien
Thanks a ton for answering the questions & helping us solve the issue, your solution with react-native.config.js totally worked!!
Altho we are likely gonna go with expo build to build our app for now since it was internally tested like this, weāll most definitely switch over to EAS for the next release to take advantage of the much smaller bundle size!