AppsFlyerSDK / appsflyer-react-native-plugin

AppsFlyer plugin for React Native
MIT License
273 stars 196 forks source link

Unable to run in Expo Go workflow #542

Closed sprutner closed 2 months ago

sprutner commented 2 months ago

Report

Plugin Version

6.13.1

On what Platform are you having the issue?

What did you do?

run npx expo start and then start the app on the iOS simulator

What did you expect to happen?

The app should load on the simulator

What happened instead?

I got this error

iOS Bundled 15248ms (node_modules/expo/AppEntry.js)
 ERROR  Invariant Violation: Your JavaScript code tried to access a native module that doesn't exist. 

If you're trying to use a module that is not supported in Expo Go, you need to create a development build of your app. See https://docs.expo.dev/development/introduction/ for more info., js engine: hermes
 ERROR  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., js engine: hermes

Please provide any other relevant information.

I am new to using the Appsflyer SDK, but based on your docs it seems like you support an expo managed workflow/expo go without the need to eject. However, this type of error seems to indicate this isn't the case. Please advise.

iway1 commented 2 months ago

Expo Go is not the same thing as managed workflow. The managed workflow supports custom native code, as is required by this library. Expo Go does not and will never support custom native code.

You will need to build your app so that the required native code is included. In general - if a library has custom native code then it will not work with Expo Go, but it will work if you create a development build or just a regular react native build.

There's no such thing as "Ejecting" expo in 2024, that's an outdated term. In 2024 it's expected to continuously generate native code using Expo

sprutner commented 2 months ago

Yup, got it. Already switched to dev builds. It would be helpful if your docs mentioned this like branch.io, sentry.io and other expo compatible plugins do as it is a sticking point for many people in the community.