Adding custom native code
The Expo Go app enables you to move quickly by building on a feature rich native runtime that is well suited for developing many types of apps. If you want to use custom native code that isn't already in the Expo Go app, you will need to generate the native iOS and Android projects that are typically hidden in the managed workflow, then build and run them.
You can do this in a single command on each platform:
# Build your native Android project
→
expo run:android
# Build your native iOS project
→
expo run:ios
Run commands were introduced in SDK 41, prebuilding and running in earlier SDKs may not work as well.
expo run:ios
requires Xcode (macOS only) installed on your computer. See the setup guide.expo run:android
requires Android Studio and the Android SDK to be installed. See the setup guide.
Using the run commands will initially
prebuild your project to generate all of the native code within your project directory. If you manually modify the
ios/
or
android/
folders, you won't be able to safely re-run
expo prebuild
, this is known as the
bare workflow.
Your app can still run in Expo Go, but any custom native code won't be accessible if it's not already present in the Expo Go app.
Learn more.
If you install a package with a Expo
config plugin, you'll need to add the plugin to your
app.jsons
plugins
array, then re-run
expo prebuild
to sync the changes before rebuilding the native app. Often this does things like adding required permissions to the
Info.plist or
AndroidManifest.xml. You may need to run
expo prebuild --clean
depending on how complex the plugin is; this will delete and re-generate the native project files from scratch.
If you've made manual modifications to your ios/
or android/
folder, you'll need to manually setup new packages because running expo prebuild
may not work as expected with an unpredictable project state (think of this like running yarn
after manually modifying your node_modules/
folder).
If you want to make static changes to your native project files like the iOS
Info.plist, or
AndroidManifest.xml and still have access to prebuilding, check out the
config plugins guide to see how you can hook into the prebuild process to make those changes.
If you've decided that you want to roll your app back to being fully managed (no iOS and Android projects in your project directory), you can checkout your most recent commit before executing expo run:[ios|android]
, then run npm install
again to restore the state of your node_modules directory.
Once you have customized the native code in your project, you can use the
expo-dev-client
package to create a development build and retain the convenience of working with just JavaScript and/or TypeScript in Expo Go. You can create a development build for your managed or bare workflow by following
our guide.
The classic
expo build
command does not support custom native code. When you're ready to ship your app, you can
build it with EAS Build or archive and sign it locally.
# Install the CLI
→
npm i -g eas-cli
# Build your app!
→
eas build -p all