DEV Community

Cover image for How we reduced our production apk size by 70% in React Native?

How we reduced our production apk size by 70% in React Native?

U Sai Rajesh on May 16, 2020

Android app size was one of the biggest concerns we had while working on React Native. As it makes tough on lower-end devices to deal will storage ...
Collapse
 
msfjarvis profile image
Harsh Shandilya

But this is not related to React Native at all, just standard Android stuff that native developers have been using for a while now. How would you go about trimming size on the React side of things would make for a much more helpful article IMO.

Collapse
 
srajesh636 profile image
U Sai Rajesh

Hi Harsh, thanks for your feedback.
I have written the above article as my experience as a beginner in react-native development, where it started from why react-native is dumping a universal apk which was huge.

Thanks for your suggestion i will try to add trimming size on react side too in the article soon.

Collapse
 
realabbas profile image
Ali Abbas • Edited

How was your intial react native apk size 43MB. Were you using Expo?
Because it is not possible at all. By default the universal apk will be around 25-27MB.

Collapse
 
srajesh636 profile image
U Sai Rajesh • Edited

Hi ali ,the app which i spoke about 43mb was our production app, which was created from react-native cli which had lot of features and third party integration,
Assets and sso and ads and push notifications, so the universal apk bloat up to 48mb.

You are right the initial react native app's universal apk will always be around 23-27mb.

If you can see above hello world, example app was 23 mb.

43 mb was our other core production app.

Collapse
 
realabbas profile image
Ali Abbas

Okay. Now I understood. Thanks for taking the time out and replying.

Collapse
 
souksyp profile image
Souk Syp.

Good to know

Collapse
 
omkarshinde96k profile image
Omkar Shinde

still 28 MB abb file of my hello world app

Collapse
 
happer64bit profile image
Wint Khant Lin

Mine is 72 MB

Collapse
 
rahhamz profile image
Rahmandi Hamzah

Hi sai, thanks for your sharing.
Is there any problem when we do codepush on the AAB file uploaded to play store?

Collapse
 
srajesh636 profile image
U Sai Rajesh

Hey Rahmandi we are also using aab and codepush combination in production nothing went wrong till now.Everything seems to be fine

Collapse
 
niyasali64 profile image
Niyasali

Can I upload the AAB file play store if it is already uploaded APK file.
is there a problem with the currently running APK?

Collapse
 
srajesh636 profile image
U Sai Rajesh

Hey Niyasali, you can upload the aab to playstore,when u will upload aab it will be considered as an update to app and older apk will be deactivated.

Collapse
 
shivams136 profile image
Shivam Sharma

Can I get the optimized 7 MB app generated on my system without publishing on Play store as it's my internal app?

Collapse
 
mohammad_makeen profile image
Mohammad Makeen

What is the command for ios?

Collapse
 
ravanar profile image
~RavaNar

@mohammad Makeen, in iOS, the ipa file optimisation is already available in the AppStore. Based on the device, the ipa is rebundled to include only the necessary resources. While developing the app you could use other optimisation techniques available such as:

  1. developer.apple.com/documentation/...
  2. developer.apple.com/documentation/...
Collapse
 
shreyventure profile image
Shreyas Shrawage

Does the aab file reduce in size only when uploaded to google play? Because, if you go ahead, right click on the .aab file to check it's size, it is equivalent to the size of .apk file.