expo: [eas][android] expo-branch cause app crash
Summary
Look like double-linking causes a crash on Android. How I can exclude expo-branch
on android?
E AndroidRuntime: FATAL EXCEPTION: create_react_context
E AndroidRuntime: Process: XXXXX PID: 10110
E AndroidRuntime: java.lang.IllegalStateException: Native module RNBranch tried to override RNBranchModule. Check the getPackages() method in MainApplication.java, it might be that module is being created twice. If this was your intention, set canOverrideExistingModule=true. This error may also be present if the package is present only once in getPackages() but is also automatically added later during build time by autolinking. Try removing the existing entry and rebuild.
E AndroidRuntime: at com.facebook.react.NativeModuleRegistryBuilder.processPackage(NativeModuleRegistryBuilder.java:55)
E AndroidRuntime: at com.facebook.react.ReactInstanceManager.processPackage(ReactInstanceManager.java:1347)
E AndroidRuntime: at com.facebook.react.ReactInstanceManager.processPackages(ReactInstanceManager.java:1318)
E AndroidRuntime: at com.facebook.react.ReactInstanceManager.createReactContext(ReactInstanceManager.java:1225)
E AndroidRuntime: at com.facebook.react.ReactInstanceManager.access$1100(ReactInstanceManager.java:131)
E AndroidRuntime: at com.facebook.react.ReactInstanceManager$5.run(ReactInstanceManager.java:1016)
E AndroidRuntime: at java.lang.Thread.run(Thread.java:919)
Can I use this config to exclude? https://github.com/expo/expo/blob/422beec748adabbf0f6be3922e9a7ea6170fb8a2/apps/bare-expo/package.json#L36-L53
Or this config? https://github.com/expo/expo/blob/1e001f80d902303a40e370c7b996b01c3b088119/apps/bare-expo/package.json#L36-L66
Managed or bare workflow? If you have ios/
or android/
directories in your project, the answer is bare!
managed
What platform(s) does this occur on?
Android
SDK Version (managed workflow only)
41.0.0
Environment
EAS build
Reproducible demo or steps to reproduce from a blank project
none,
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 1
- Comments: 27 (11 by maintainers)
Yes, the presence of android/ios directories means you have a “bare” app, rather than a managed app.
See here: https://forums.expo.dev/t/should-i-exclude-ios/63094/4?u=wodin
I’m coming to the conclusion that ios/ and android/ folders are only needed on the local box to be able to run the apps on Simulator directly (opposed to Expo go) – there is no need to version control these folders, they will be re-generated on the eas build server (or on local) as needed.
It all finally works! Thank you for your help.
@giautm I’m wondering, if this proposed solution is ready to be used? I’m trying to follow the documentation and on prebuild steps for run:ios and run:android getting a lot errors.
Thanks @jvincent-dev, that’s very helpful!
hey @robert-nash and anyone else having trouble setting up Branch with EAS, I have helped someone else with this and you can find their forum post here. I hope this helps!
@jvincent-dev I would be very interested to hear more about how you figured this out and if you’ve now got react-native-branch working? Thanks!
Expo has dependency on react-native-unimodules. So, you don’t have to install it, just put that config to package.json.
Anw, they have new autolink engine. So, this method will no longer support soon.
I also blocked by issue #12906