Expo Prebuild | Optimizing React Native Android/iOS Apps

Expo Prebuild | Optimizing React Native Android/iOS Apps

Expo prebuild is a feature provided to improve the performance and reliability of the React native application.

When you run the expo prebuild command, it recompiles some basic JavaScript code and assets.

I’m developing an Android application. When I tried to change the icon and splash screen, changes were not reflected after building the Android and iOS apps. I created a build multiple times but had no luck. Bizarre!

Then I prebuilt the expo project and built the application. Surprisingly all the changes were reflected and working smooth as expected. Android and iOS app icon was changed. The splash screen background color and image were working.

What is the expo prebuild command?

The prebuild feature is used to create native iOS and Android project files for building natively.

When you run the expo prebuild command, it compiles some of the basic JavaScriopt and assets files and stores them in the android/ios folder.

Here is the expo prebuild command.

npx expo prebuildĀ 

There are several options available for prebuild command. Run the below command to get the last of the prebuild options you can pass as command parameters.

npx expo prebuildĀ -h

It is always good practice, to run the prebuild command before creating the final project build. Make sure, you don’t have any changes in the files present in the android/ios folder. Otherwise, it will overwrite those files and you may lose your changes.

Note: Expo also executes the prebuild command but it ignores it if the android/ios folder is present in the project directory. If you want your application to prebuild the files when you run the expo build, delete android/ios folder. Files in this folder will be created again.

If you have any doubt, write to me in the comment section below.

Leave a Reply

Your email address will not be published. Required fields are marked *