build.gradle in expo-cli, managed workflow

So I am a big fan of the expo-cli and the managed workflow environment have been building in it without any issues for some time now.

However now I am in need to make a small change to the Android build.gradle, what is the best way to do this if I wanna keep working with the exp-cli and then being able to push updates to the app stores through the air with expo publish.

I tried Expo eject for the first time but was getting bunch of errors, also not sure if I use expo eject, will I be able to go back and use the expo-cli normally?

So my problem is just adding 1 line of code to build.gradle, what would be the best way to do this without messing up the current app?

Hi @rewardy

As a matter of interest, what is this line you want to add? And is it android/build.gradle or android/app/build.gradle you need to modify?

The best thing to do would be to write a config plugin to do your build.gradle change and build with EAS Build. Depending on what change you want to make you might be able to continue using Expo Go. But you might need to build a custom dev client, which is basically like a customised Expo Go with your native dependencies/changes to build.gradle etc. built in.

Here’s an example: Managed EAS build - How to edit build.gradle via mods. - #2 by wodin

Hey @wodin Wodin, thanks for your quick response and all the information gonna make sure to check it all out!
So I dont nessecarily need to have the app running on Expo Go, more interested in just keep development in it and being able to keep pushing in air updates to my app in playstore.

I am currently trying to add applovin to the app through this react native module:

So I just need to make these changes to the root-level build.gradle and app level build.gradle. Gonna try it out with plugins like you mentioned, but might do with custom dev client aswell since it seems more useful for future cases.

OK, so those Android Instructions would be in addition to doing something like yarn add react-native-applovin-max which would add some native code under node_modules/react-native-applovin-max.

For this you would definitely need to use EAS Build (either Expo’s build servers or build locally with --local) or else you would need to eject, which would of course also involve building locally.

You would not be able to use Expo Go for development (unless you can avoid calling into react-native-applovin-max when in development mode). But if you’re using EAS Build anyway, you may as well build a custom dev client, which would replace Expo Go for development purposes.

You can use Expo’s OTA Updates in any react-native app, so this should not be a problem regardless of what route you choose, but if you can write the config plugin and stick with the managed workflow that would be best in my opinion.

EAS Build compiles in only the code from your dependencies in package.json. This is what allows EAS Build to produce smaller apps and also allows it to include custom native code like Applovin. But this means you need to be more careful with OTA updates than if you’re using the classic expo build.

When I was figuring out how to make simple config plugins (the example I linked to in my other comment) I found it useful to run expo prebuild to check that the changes to build.gradle etc. looked correct. This makes some changes that you’ll want to clean up again after you’re happy with the results. I also found it useful to read through some of the info on the build process like this.

Hey again wodin, not sure if this is allowed here but would you be open helping me develop/setup this for a payment?


Maybe try one of the companies listed here?

Oh that’s a great resource, thanks!

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.