Efficient to Reduce React Native APK Size: Migrating from Expo, Optimizing Build Configurations, and Enabling ProGuard for a Smaller, More Efficient Mobile App
Ways to Reduce React Native APK Size
- Migrating to React Native from Expo
- Make Changes in android/app/build.gradle
- Set
def enableProguardInReleaseBuilds = true
- Set
def enableSeparateBuildPerCPUArchitecture = true
- Set
1.Migrating to React Native from Expo
I Love everything about Expo except the size of the binaries. Each binary weighs around 25 MB regardless of your app.
So the first thing to do is migrate the existing Expo app to React Native. This is the simplest and coolest method to reduce your APK
To migrate the expo app 1st step to follow is
Open your root directory and execute the following the command

This will download the required dependencies and build native projects under the ios
and android
directories.
2.Make Changes in android/app/build.gradle
This is what you have been waiting for, I know.
1. Open up android/app/ build.gradle
2. Set
def enableProguardIn ReleaseBuilds = true
this would enable Progaurd to compress the Java Bytecode. This reduces the app size by a tad bit
3. Set def enableSeparate BuildPerCPUArchitecture = true
.
Android devices support two major device architectures armebi
and x86
. By default, RN builds the native libraries for both these architectures into the same apk.
Setting the last function creates two distinct apk in the build folder. You have to upload both of these apk to Play Store and Google would take care of distributing the app to the correct architectures.
Using this split generates version numbers for both apk’s in the order of 104856 and such. This is auto-generated by the build to avoid version conflicts, so don’t freak out (I did).
This split reduced the apk size from around 7MB to 3.5MB for arm
and 5MB for x86
respectively.
Yeah
So that’s how you lose weight. Reducing the size of your app has many added benefits, the best being more users will be willing to download your app. And the App won’t consume more space in the user device.