ExpoKit + Branch.io


I would like to integrate Branch.io into my ejected Expo app, but keep running into problems. I have tried integrating using both the standard Android guidlines, here…

…and also, the specific React Native guidelines, here…

(I’m assuming the latter is the one I should focus on. I am able to build my app, but unable to run it, as I am presented with the following error:

Key package versions:

Am I missing a trick here?

Hoping someone else has run into this problem and it’s a simple solution!

Hey @tomosedplus - we just made a bunch of changes to our alpha Branch support that should give you some helpful context?

Thank you @jess - that’s useful context. So, would you expect the conflict to disappear if the versions are updated per your blog post? I will give it a try, just keen to understand the anticipated behaviour… Thanks again.

Yes - one thing to call out specifically from the post, though, is that in our experience you need to update all tracks, not just the one in production. Let us know if this doesn’t resolve for you!

Hi @jess. Sorry, just to clarify, by “conflict”, what I was referring to was the conflict between the Branch modules in react-native-branch and those in Expo, as opposed to the conflict with Google Play Store. Let me know if that was what you were also referring to - if so, great! Thanks again.

@tomosedplus - expokit@32.0.7 already includes all of the native modules for Branch, so you should be able to continue working with your project exactly as before. No need to install the react-native-branch package separately, at all.

1 Like

Hi there. I really appreciate the responses here; I’m grateful for the help. I will admit to still being confused though? I have an ejected Expo app that targets both iOS and Android. I am integrating Branch for attribution, deep linking etc etc.

I understood that…

  • The Expo Branch API only includes a subset of the full Branch API.
  • Expo support extends only to iOS.
  • Expo support extends only to managed (not ExpoKit) apps.

Perhaps these assumptions have been superseded by Jess’s remarks, though it would be great to know if any of the assumptions above are incorrect?

Thanks again.

Hi @tomosedplus - sorry for the somewhat confusing situation here. To clarify:

Expo support extends only to managed (not ExpoKit) apps.

This is not true – you can use Branch in ExpoKit apps in the same way you would in managed apps, and there is no need to install react-native-branch. Branch is part of the ExpoKit package on iOS (and older ExpoKit packages on Android – see below).

Expo support extends only to iOS.

This is true, with one caveat – we used to support Branch on Android apps as well but had to remove that recently (see the blog post Jess posted above). However, if you use an older version of expokit for Android – specifically, 32.0.7 (which you’re already using) – then Branch is still included.

Hope this helps. Let us know if we can help clarify anything else!

Hi @esamelson. Again, I appreciate the time you have taken to respond, and I apologise in advance for any naivety in my questions…

So, to update you on the current state of play for me (prior to my response):

  • I have upgraded to ExpoKit 32.1.1 and integrated Branch successfully into my Android build, using Branch’s React Native setup guide.
  • I have attempted to follow the same setup guide for iOS, but end up with build failures, seemingly due to a clash between the “Branch” pod and the “Branch-SDK” pod. An analogous situation to my original Android problem.

Based on the information that you’ve kindly given, it feels like my options are as follows:

  1. Press on with trying to resolve my iOS dependencies issue.
  2. Downgrade ExpoKit to 32.0.7 (and stay there), then attempt to integrate with branch the “Expo” way for both platforms, removing any additional dependency added on react-native-branch.
  3. Leave ExpoKit at 32.1.1 and attempt to integrate Branch the “Expo” way, but for iOS only, leaving Android using react-native-branch separatelu

(I’m assuming that #3 is infeasible but have included for completeness?)

Am I right in thinking these are my only options?
Would you have a recommendation on which way to go?

Again, appreciate the support.

Hey @tomosedplus - I’m sorry for the difficulty with this :disappointed: I’m not sure exactly why there’s a clash on the iOS side of things – perhaps your version of react-native-branch is too new? (We are on a somewhat older version iirc). Regardless, I think the options you’ve outlined are the correct ones for now. If you’re unable to resolve the iOS issue, I’d suggest sticking with your option 2 for now. We’re working on figuring out a better solution for Branch support with SDK 33 (which could be either including a safe version or removing it entirely from both platforms).

FWIW, we just upgraded to SDK 32 and faced a similar situation (need to support branch). Option #2 (32.0.7) worked just fine.

Hi all - thanks for all the help and replies - genuinely appreciated.

I have been able to get this working by now. For completeness, I pursued the following avenue:

  • Continue with ExpoKit 32.1.1 (I felt uncomfortable pegging at a specific version).
  • Use the react-native-branch SDK for Android.
  • Use the Expo-provided SDK for iOS (i.e. not including the react-native-branch dependency).

With a few modifications to the native code samples in the various docs, this combination works (for now!).

I think this is one area where the…

  • …Expo docs
  • …Branch (standard) docs
  • …Branch (React Native) docs

…don’t fully align, so it’s not immediately obvious what to do. Perhaps this can be cleared up with SDK 33, once the situation with Branch’s inclusion in Expo becomes more apparents / concrete?

Thanks again for all the help…

Hi, can you share your steps to make this work? I’m testing for IOS only with:
ExpoKit 32.1.1
Following the expo doc: https://docs.expo.io/versions/latest/sdk/branch/
So in my componentDidMount, I have a simple console.log of brach listener

		DangerZone.Branch.subscribe((bundle) => {
			console.log('bundle', bundle);

But it doesn’t work at all. Every thing builds just fine but this function is never called.