Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

React Native initial App size is too large

Tags:

react-native

I know this question asked before but the solutions provided there is not enough to reduce app size.

I have create a app using react-native init. No any third party library added yet. Just a hello world app. but its release build size is 48mb.

After that I used def enableProguardInReleaseBuilds = true it reduced 2Mb and app size become 46MB.

Again I used def enableSeparateBuildPerCPUArchitecture = true app size reduced to half now its 26MB.

But why just a hello world app in react-native takes 26MB. Its seems quite useless.

Here is my package.json file

{
  "name": "WooVendors",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "start": "node node_modules/react-native/local-cli/cli.js start",
    "test": "jest"
  },
  "dependencies": {
    "react": "16.8.3",
    "react-native": "0.59.5"
  },
  "devDependencies": {
    "@babel/core": "^7.4.4",
    "@babel/runtime": "^7.4.4",
    "babel-jest": "^24.8.0",
    "jest": "^24.8.0",
    "metro-react-native-babel-preset": "^0.54.0",
    "react-test-renderer": "16.8.3"
  },
  "jest": {
    "preset": "react-native"
  }
}
like image 782
Abhishek Singh Avatar asked Nov 26 '22 00:11

Abhishek Singh


1 Answers

Using Android App Bundle(aab) will slightly reduce apk size (>=8Mb).

To generate Android App Bundle follow Official Guide Here

like image 164
Abhishek Singh Avatar answered Jun 17 '23 11:06

Abhishek Singh