I am not very familiar with java/Android development but I find something that might be related to the issue. So I post here to ask for opinion/help.
I am using create-react-native-app to eject with ExpoKit. After eject, the MainApplication.java includes a class MainApplication
which extends MultiDexApplication
. If I eject with normal react-native project, the same class extends Application
as well as implements ReactApplication
. This interface needs to implement getReactNativeHost
method which returns a ReactNativeHost
.
Some libraries expect that the MainApplication
is a React application which has a getReactNativeHost
. For example:
https://github.com/wix/react-native-notifications/blob/c8594ba1f8edcbba5d76d6626c069a37c345c904/android/src/main/java/com/wix/reactnativenotifications/gcm/GcmToken.java#L124
https://github.com/evollu/react-native-fcm/blob/c1704b079e6406da1a1a87317fc0ceef512e7ca3/android/src/main/java/com/evollu/react/fcm/MessagingService.java#L41
The app crashes when run into these lines. So my questions are:
- Why implementation of MainApplication.java is different between expo and plain react-native?
- How can I use those libraries with ExpoKit?