Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
September 29, 2021 08:11 am GMT

How to Reduce your Android release App size, up to 47% or even more React Native

image

After finished developing and building your app, you then realise that it is somewhat bigger than what you prefer.
The first thought that comes to your mind is "how can this be reduced?"
Consider using Hermes to achieve this.

In one of our apps at Quick Component, we experienced about 19.2 percent decrease in app size when building release with Hermes. See the image below.

Without Hermes
image

With Hermes
image

Also checkout another app where about 47% decrease in app size was experienced using Hermes.
image

How do we build with Hermes?
You only need to edit one or two files.

In android/app/build.gradle enable Hermes

 project.ext.react = [         entryFile: "index.js",              enableHermes: true  // clean and rebuild if changing  ]

Also, if you're using ProGuard, you will need to add this rule in proguard-rules.pro :

-keep class com.facebook.hermes.unicode.** { *; }

Next, if you've already built your app at least once, clean the build:

$ cd android && ./gradlew clean

And now you can build ur release as you would normally do with

./gradlew bundleRelease

Also note that There are other benefits to using hermes like stated here:
Hermes is an open-source JavaScript engine optimized for running React Native apps on Android.
For many apps, enabling Hermes will result in improved start-up time, decreased memory usage, and smaller app size.

Also, ensure you're using at least version 0.60.4 of React Native.

Checkout a fully functioning templates with backend like the Dating app, Whatsapp clone(with audio and video calling), UberEats clone and more built with React Native.


Original Link: https://dev.to/kyle_buntin/how-to-reduce-your-android-release-app-size-up-to-47-or-even-more-react-native-h95

Share this article:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To