Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

React Native for small size apk with low internet bandwidth

I am planning to develop an app for emerging market with low internet bandwidth. The app heavily requires an internet connection to function.
I need this app to have a small apk size (not more than 10mb) and work on 3G network.
Based on my research if I remove x86 JS binary files from React Native the apk size could be as small as 4mb. I suppose the 4mb does not include the JS files and images so client needs to download that first time when he/she opens the app, is that correct?
Would it in general be a good idea for me to use React Native if I want an app with less than 10mb apk size that works on 3G and what are the best practices to make it efficient?

like image 666
abeikverdi Avatar asked Jul 04 '16 12:07

abeikverdi


People also ask

What is the size of React Native APK?

Migrating to React Native from ExpoEach binary weighs around 25 MB regardless of your app. This will download the required dependencies and build native projects under the ios and android directories.

How big is reduce React Native Expo app?

Then after you need to run expo build:android command to create and apk. If you want to upload it in play store then it much better that you run expo build:android -t app-bundle and upload it. At play store bundle reduce their size approx. 30-40% of its actual size.


2 Answers

Instead removing js which have very less impact you should go after binary resources such as font and embedded images. Apart from that these are following techniques that may work for you:

1) Enabling Proguard:

To enable Proguard, edit android/app/build.gradle:

def enableProguardInReleaseBuilds = true

Generate Separate Builds:

2) In your app/build.gradle set

def enableSeparateBuildPerCPUArchitecture = true

3) Remove x86 from abiFilters

Following are references to links that you may find useful:

Blog on decreasing size of apk:

https://realm.io/news/reducing-apk-size-native-libraries/

Link one of smallest RN app on play store:

https://github.com/sonnylazuardi/ziliun-react-native

Useful discussion on React Native Issue regarding apk size:

https://github.com/facebook/react-native/issues/5037

like image 120
Chromonav Avatar answered Oct 28 '22 08:10

Chromonav


If you just want the app with lower app size, Use native platform itself. Minimum size of the native android app will be 1 MB. You can't reduce the size of the react native app lesser than 4 MB.

like image 3
Sriraman Avatar answered Oct 28 '22 08:10

Sriraman