'How to reduce size of a React Native Application [closed]
I have created a simple React Native application but the size of the application is very large when I create a build for Android, around 35mb. How can I reduce my application's size?
I am using :
expo build:android
Solution 1:[1]
From your project directory, run expo eject
This will download the required dependencies and build native projects under the ios and android directories.
then go to android/app/build.gradle and change
project.ext.react = [
enableHermes: true, // false to true , clean and rebuild if changing
]
* Set this to true to create two separate APKs instead of one:
* - An APK that only works on ARM devices
* - An APK that only works on x86 devices
* The advantage is the size of the APK is reduced by about 4MB.
* Upload all the APKs to the Play Store and people will download
* the correct one based on the CPU architecture of their device.
*/
def enableSeparateBuildPerCPUArchitecture = false // change to true
/**
* Run Proguard to shrink the Java bytecode in release builds.
*/
def enableProguardInReleaseBuilds = false // change to true
android {
splits {
abi {
reset()
enable enableSeparateBuildPerCPUArchitecture
universalApk false // If true, also generate a universal APK
include "armeabi-v7a", "x86", "arm64-v8a", "x86_64"
}
}
}
PS: ExpoKit is deprecated and will no longer be supported after SDK 38. If you need to make customizations to your Expo project, we recommend using the bare workflow instead.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Sudharsan Palanisamy |
