0

I was trying to a react native application which just take a phone number and have country codes. This app is of size 60mb. Whereas large apks such as facebook and uber which are also build on react native are of around 100 mb.

How is this possible?

I have even tried this also.

 Open up android/app/build.gradle
Set def enableProguardInReleaseBuilds = true this would enable Progaurd to compress the Java Bytecode. This reduces the app size by a tad bit
Set def enableSeparateBuildPerCPUArchitecture = true . Android devices support two major device artitectures armebi and x86. By default RN builds the native librariers for both these artitectures into the same apk.
  • Does this answer your question? [React Native initial App size is too large](https://stackoverflow.com/questions/56017297/react-native-initial-app-size-is-too-large) – Thanhal P A Feb 17 '22 at 07:19
  • AAB is the solution to reduce the size when publishing on Play Store. for more, refer this : https://stackoverflow.com/a/60631207/10657559 – Thanhal P A Feb 17 '22 at 07:25
  • @Thanhal after aab creation the size is 9 mb. But similar apps in java/kotlin is of 1-2 mb – khogyassss121 Feb 17 '22 at 07:44
  • Ya it's because we are using some initial packages to run react native project. But look at the bright side by comparing the size of universal apk and size after aab – Thanhal P A Feb 17 '22 at 07:58

2 Answers2

2

You have to optimise your app size. There are some approaches through which you can optimise the size of your app

- Remove unused libraries from `package.json`
- Remove unused `imports` from all the files in the app.
- Remove unused assets including Audio, Video and Images files
- Resize the images which are using in the app.
- Using Hermes, is an open-source JavaScript engine optimized for React Native. 
  For many apps, enabling Hermes will result in improved start-up time,
  decreased memory usage, and smaller app size.

More details Hermes

Nooruddin Lakhani
  • 7,507
  • 2
  • 19
  • 39
0

beside all issues @Nooruddin-Lakhani mentioned above this can also help :

also keep in mind Generate release as Bundle will help you!

Amir Doreh
  • 1,369
  • 1
  • 13
  • 25