React Native 初始 App 大小过大

Abh*_*ngh 5 react-native

我知道之前问过这个问题,但提供的解决方案不足以减少应用程序的大小。

我已经使用react-native init. 尚未添加任何第三方库。只是一个你好世界的应用程序。但它的发布构建大小是 48mb。

之后我使用def enableProguardInReleaseBuilds = true它减少了 2Mb,应用程序大小变为 46MB。

我再次使用的def enableSeparateBuildPerCPUArchitecture = true应用程序大小现在减少了一半,现在是 26MB。

但是为什么只有 react-native 中的 hello world 应用程序需要 26MB。它似乎很没用。

这是我的 package.json 文件

{
  "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"
  }
}
Run Code Online (Sandbox Code Playgroud)

Abh*_*ngh 1

使用 Android App Bundle(aab) 会稍微减小 apk 大小 (>=8Mb)。

要生成 Android App Bundle,请遵循此处的官方指南