Adding multiple targets and product flavors

Hi,

We’re building a white label app at work and I had planned to use EAS build. Very little changes between app versions, except app icons, splash screen and some env variables. Everything can be configured from the app.json. I’m using an app.config to change the required settings based on each app. I pass a variable to the expo cli to determine which app to build. All this works fine locally but when I do the same with eas build it fails.The expo run commands work fine.

Also I need to make changes to the native android folder manually because I need a newer version of stripe than expo currently supports. This has caused me issues because if I need to change the app config for the android project, I need to delete the android folder and make all my manual changes again. Is there anyway around this? I could handling all this badly so if anyone has any suggestions they’d be very appreciated

Thanks

You should look at the build logs to find the error, and then go from there

Also I need to make changes to the native android folder manually because I need a newer version of stripe than expo currently supports. This has caused me issues because if I need to change the app config for the android project, I need to delete the android folder and make all my manual changes again. Is there anyway around this?

Maybe the best thing to do would be to make the change as part of patch-package or even an EAS build npm install hook: Integrating with third-party tooling - Expo Documentation

As a matter of interest what are these manual changes? And what newer version of Stripe is this?

Hi Charlie,

This is what I got from the logs

What I want to be able to do is something like
eas build -p ios --scheme app1
eas build -p android --variant app1

I can make this all work in a vanilla RN project, I’d just have to do all the builds manually. I’d like to be able to make changes, rebuild a submit all the app variants. I’m probably not explaining this clearly. I’m a native developer and this is my first attempt at using RN on any serious project.

Expo installs stripe version 0.1.4 I think but that doesn’t include the CardForm component so I bump it to 0.2.1. Because of this I have to add material as a dependency and change the top level theme to a material theme.

hmmm…

This is surprising to me:

Installation

Each Expo SDK version requires a specific @stripe/stripe-react-native version. See the Stripe CHANGELOG for a mapping of versions. To automatically install the correct version for your Expo SDK version, run:

expo install @stripe/stripe-react-native

@charliecruzan I thought that by Stripe writing a config plugin, they would be able to do whatever’s necessary and it would not require anything special from Expo? Why is the @stripe/stripe-react-native version constrained by the Expo SDK version?

Yeah I thought the same. You get a warning when you run the the app that the version of stripe is not compatible with the version of expo.

I’ve ended up having to move away from EAS build for now because I just don’t have the time to figure it out. What I’ve done is add the targets and product flavors to the native projects as I would have always done, use the same methods as normal for env variables and use a native module to get access to them from javascript. I’ll have to do all the builds locally which is annoying but the app is nearly done and I just reverted to what I know for now. I’m sure what I want to do can be made work eventually or I’m just not experienced enough with RN to do it right now.

Well, I believe you can still use EAS Build for arbitrary React Native projects, so if you want to build in the cloud instead of locally, you can still use EAS Build.

And I suppose you could possibly check again when SDK 43 is released (going by Expo’s recent releases I think this would be around the end of the month.)

Ideally I would still use expo as I had originally planned. All the manual config I have to do now is painful. Hopefully SDK 43 will bring more documentation. The docs are always great but I feel like I don’t understand EAS Build fully yet.

I found this stuff useful:

Also fyi/prebuilding.md at master · expo/fyi · GitHub

Config Plugins are still a bit of a black box to me. I have an idea of how they work and what they do, but haven’t wrapped my head around the details yet.

One day I’ll make time to dig into the existing plugins under the packages directory in the expo/expo repository, and the expo/config-plugins repository and then other libraries that have their own plugins like Stripe, React Native Vision Camera, etc. and figure them out properly.

Other posts that I’ve made a note of along the way:

What I want to be able to do is something like
eas build -p ios --scheme app1
eas build -p android --variant app1

for ios scheme can be already defined in eas.json
for android you can specify gradleCommand to select which flavor you want to build,

android part is not 100% ready, for now it won’t work if you have a different applicationId for a different flavor and using expo to mange keystores, if that is the case it might sign your build with keystore assigned to wrong applicationId. Everything should work after [eas-cli] support multiflavor android projects by wkozyra95 · Pull Request #595 · expo/eas-cli · GitHub lands