3

I created two versions of the same mobile app using two diffrent technologies. React Native + Expo and React + Capacitor.

What caught my eye is that the difference in the size of APK packages is quite big. So I tried creating a Hello World app with React Native + Expo and even that app was quite large in size. What exactly causes even simple apps created by React Native to be so large?

m_novak
  • 117
  • 10

1 Answers1

1

React native has a lot of boilerplate code which it needs for creating a bridge between react native and native. and along with that it has node modules other dependencies which increase the APK size.

Basically app sizes can depend on :

  1. JS code (eg your written code in js, nodemodule codes written in js)
  2. Native code( Since RN communicates with the native side, it creates a bridge and hence more boilerplate code is added by default for that to happen)
  3. Assets(eg images , videos ) those can hamper size, hence its always better to have remote URLS.

One suggestion would be creating an AAB file, and then uploading to playstore since that decreases size by quite a significant amount.

You can also check this thread RN-reducesuze

Do let me know in case of any doubts

Gaurav Roy
  • 11,175
  • 3
  • 24
  • 45
  • Thank you for your reply. It's clear to me that the final size of the APK will depend on other components such as images, videos or node packages. But as I mentioned, even the newly created project with the Hello World splash screen is quite large without including images etc. – m_novak Jun 07 '22 at 10:21
  • yes correct, that will be large, as mentioned because of the first two points – Gaurav Roy Jun 07 '22 at 10:45