How to reduce app size in expo sdk version 36? - react-native

Even the simplest app built on EXPO sdk v36 is almost 50MB. Is there a way to reduce the size ?.
I was working with EXPO for some time and until sdk v32, the size was not that big and then it all changed. I expected a solution at least in their new version.

do expo build: android --type app-bundle to get an android app bundle, this bundle will be optimized by Google for different android versions and are smaller in the end.
When expo updates its react-native version to 0.61, using Hermes should decrease your app size significantly and also decrease TTI by up to 2s. I was at React Native EU conference so this is the latest info.
Hope it helps .feel free for doubts

Related

Remove expo vector icons from RN Project(Expo Bare Workflow)

Using Expo Bare Workflow
Expo SDK Version: 40.0.1
Platform: iOS
We are trying to build an iOS AppClip which has a size constraint of 10MB.
While creating the IPA file we see expo vector icons are packaged along, which is increasing the size by around 4MB which is making a big impact on the size constraint. We want to exclude these assets specific to expo vector icons from the final binary. We are now stuck here to figure out a way to exclude these and cut down the size, any help from the community is highly appreciated!

Huge size difference between app bundles build by pure react native & expo bare workflow

I have build two app bundles for same application by pure react native (version 0.66) and expo bare workflow (expo eject, expo version: 42.0.1, react-native version: 0.63.4 )
Build by
App bundle size (mb)
Pure react native
29
Expo bare (eject)
14
There is a huge size difference (15 mb) between two app bundles.
When I looked into app bundles for my device I found that config.arm64_v8a.apk has two different sizes.
Build by
config.arm64_v8a.apk(mb)
base.apk(mb)
Pure react native
18.2
12.2
Expo bare (eject)
11.5
12.7
I couldn't find out why config.arm64_v8a.apk has two file sizes in these two flows.
Why expo bare workflow app bundle is so small ? Is this because currently expo use react-native 0.63.4 or does expo has some additional app bundle size reducing method(s) ?
Thank you.
Expo has recently published a blog post about app bundling.
bundle sizes are also smaller by about 18% in “Hello World” apps. This is because many libraries are already shipped in an optimal format, and by needlessly transforming them with a random Babel cocktail, we increase the size, but only a little bit, and everywhere.
I think it's an interesting read (and good source!) for what you're looking for:
https://blog.expo.dev/drastically-faster-bundling-in-react-native-a54f268e0ed1
Put android:extractNativeLibs="true" into the AndroidManifest.xml under application tag

How to reduce apk or aab file size in react native using expo?

I have just started react native with expo. My first app has only one App.js file and one component of counter. When I have built it, surprisingly my apk size was 49MB :open_mouth: I wonder why its so and how to reduce it without ejecting???
Expo is purely for development purpose , and its only recommended for production if your app is very basic and doesnt have much of native functionalities. Even expo is slower and has much limitations. The larger size of expo is due to the expo wrapper which sits on top of react native , which has a lot of in built modules and thus making it larger.
Recommendation: If you want to lower the apk size , you should migrate to pure react native as expo doesnt give the power of actually decreasing the app size since its handled by expo.
You can even check this link expo -size which also had the same query .
Hope it helps.

Use expo partially with RN with custom native-modules

I'd like to try expo for faster development.
It's said that you can't use native-module if you use expo.
But it seems it's possible to use native-module if you eject or use bare mode. (not sure if they are the same)
Or it seems it's even possible to start from RN-cli and add expo features.
Are they all the same in what we can do in the end?
How about apk size? Is there a way to cut down the 20-25M file size by starting from RN-cli and adding Expo on top of it or by ejecting ?
I don't think you can do that and achieve 25M File size.
But, I will give you a good solution if you want expo functionality as well as the Native capabilities.
You can try the bare minimum setup with expo.
What it will do is, It will create a react-native init project with unimodules.
Unimodules will have access to some basic expo features, for example permissions etc etc.
And in future if you want to add some other expo feature (which supports bare apps).
You can add them pretty easily.
In expo docs, you can check which features are available in bare apps and which are not.
The main concern for me is that bare apps don't support the background tasks of expo yet.
I always start my apps with this. But the downside would be that the app would be around 30-35mb,
You can still try to minimize it
https://medium.com/#aswinmohanme/how-i-reduced-the-size-of-my-react-native-app-by-86-27be72bba640
Expo has group of packages provided by expo.io. The app built with expo has bigger apk size because we are also bundling the packages which we are not even using. these are the packages comes with expo
https://github.com/expo/expo/tree/master/packages
Best solution to reduce apk size is start with building app without expo then add only required dependencies. If your project needs expo features you can use Expo kit
https://docs.expo.io/versions/latest/expokit/expokit/
Thank you

Why expo sdk 34 makes bigger app size than sdks before it?

I am having an issue where after building expo with SDK 34 which is currently the latest release it has a bigger app size than most of the sdks before it
I was using SDK 29 before that which output android app size 19 MB
without any additional things after upgrading app size is 45 MB
I am currently building the app normally using this command
expo build:android
also I have tried to make an Android app bundle but it was 47 MB and I used this command
expo build:android -t app-bundle
How to lower app size in expo or should I eject ?
Thanks in advance
Refer issue https://github.com/expo/expo/issues/5167
The size increase is due to adding FaceDetector feature in SDK 34.
Not able to make those unused modules optional yet. (answer at 08/2019)
The higher the Expo version, the larger the number of modules for dependencies. Your adding of the sauce is not so affected. Two to five megabytes?
It is most desirable that you try to reduce the size of the app after turning it into a stand-alone app.
To create a stand-alone app and reduce the size of the app, see this link.