We all have faced problems related to the size of the built apk in React-Native. The size of the apk is usually very high . This eats up a lot of space in the phone's storage. Let's look at a few methods to avoid large apk size in the final bundle.
One simple method is to use light-weight assets. Use jpg instead of a high quality png image (if not required). Use vector icons(Prefer React Native Vector icons). Optimize your image files using some tools like tinypng.com. Also, remove unused codes and JS files.
You can use alternate node modules to reduce the size of APK by finding the weight of your current node modules by the use of cost-of-modules(npm install -g cost-of-modules).If any module is of high cost, replace it with less cost alternatives.
Navigate to android/app/build.gradle .Set the def enableProguardInReleaseBuilds to true.This would enable Proguard to compress the Java ByteCode leading to reduction in the apk size.
Navigate to android/app/build.gradle .Set the def enableSeperateBuildPerCPUArchitecture to true.This would build different apks for different CPU architecture(x86 and arm).Upon publishing on playstore, playstore will automatically deliver required apks according to the phone's CPU Architecture.