‘Prebuild’ in Expo

Dahee Ahn
2 min readMar 4, 2024

--

Hi there! I started an interesting development project which is built with Expo.

So I’ll write its process in English to remember it and improve my English skill.

Let’s get started!

Introduce ‘Prebuild’

When using a third-party library in Expo, you need to check that it can be used in ‘Expo Go’ App. You can search and find it in React Native Directory. After that, Originally, you don’t have to worry about native-code anymore.

But some libraries require native module which is not provided in Expo.
Then… Do we need to do ‘Eject’!?🤬🤬🤬
Fortunately, we have ‘Prebuild’😍

You can follow the prebuild process with this doc.

After running ‘Prebuild’, native directories(/android, /ios) are generated (like below pic).
And then, you can manage custom native code without any ejecting.

android and ios folder are generated after ‘prebuild’

Finally, run expo run:android or expo run:ios before running expo start.

Due to ‘Prebuild’, application’s native code can be customized.

Use Library: React Native Voice

‘React Native Voice’ is the library I’m trying to use.

It can be used in ‘Expo Go’ application according to React Native Directory (as I mentioned above).

So I installed it and ran expo start.
And guess what result was…
Exactly. It didn’t work. (development thing is like that🥲)

This library says that ‘This package cannot be used in the ‘Expo Go’ app because it requires custom native code.”

Okay. Do ‘Prebuild’ right now to generate and manage custom native code.

All you need to do is simple.
1. Add the config plugin to your app.json or app.config.js.
2. Rebuild application as described in the Adding custom native code guide. npx prebuildnpx expo run:ios or npx expo run:android.

During this process, there may be issues with CocoaPod or some libraries. You can easily find a solution on the Internet.

This is end of article.
Still enjoy your Expo Development!

*Reference

--

--