I am developing an app by using react native with react-native that display my name on the screen. As I am compiling to Apk file. The size goes up to 27 MB. Is this normal? Are there any ways to reduce the size of the app ? Thank you guys
-
Read this https://stackoverflow.com/questions/49993006/how-to-reduce-the-size-of-an-expo-react-native-app-on-android – Iban Dominguez Noda Aug 25 '21 at 13:36
4 Answers
If you want to know more about why the .apk file has such a large size, you can open it using an archive tool as you would use to open, e.g., a .zip file. Bundling a fresh react-native project I end up with an .apk of size 31.4 MB, so yes, I would say that this is normal. This is what my generated apk contains
- app-release.apk 100 %
- okhttp3 0.064 %
- kotlin 0.077 %
- META-INF 0.33 %
- assets 0.85 %
- res 1.93 %
- lib 89.77 %
- armeabi-v7a 19.32 %
- x86 22.73 %
- x86_64 26.14 %
- arm64-v8a 23.86 %
As you can see, the majority of the size comes from the sub-folders of the lib directory. These directories contain .so-files (compiled libraries) for different platforms. This is mentioned in the docs:
By default, the generated APK has the native code for both x86 and ARMv7a CPU architectures. This makes it easier to share APKs that run on almost all Android devices. However, this has the downside that there will be some unused native code on any device, leading to unnecessarily bigger APKs.
If you want to reduce the size you look into using Proguard to reduce the size of the apk.

- 1,544
- 9
- 13
Other than Hermes, you can try removing some libraries that can be replaced. From your question I can sense that your app is a simple basic app but if you do have any, you can try and see which libraries are taking a lot of storage space.
As for myself I removed @react-native-firebase/firestore and reduced about 5~10MB, along 5 minutes of build time (didn't realize it's such a massive pacakge, but to be fair, the firebase sdk v9 aims to solve this problem with modular imports, but not supported by the react-native library yet).
On top of that, your question is likely a duplicate of this SO question, so you can check this out.

- 589
- 6
- 15
go to android\app\build.gradle and make this options true in addition you can also enable hermes
def enableSeparateBuildPerCPUArchitecture = true
def enableProguardInReleaseBuilds = true
It will return emulator and release apks separately if you want all combine you can use .aab format rather then apk . playstore uses .aab and installs app version suitable to user's mobile version.your 27mb file hardly will 7-8mb in actual build/installs in .aab but for personal use or testing solution above is preferable arm-v7 version of apk run almost every android phone so pick armv7 from release builds for installation

- 11
- 1
- 2