facebook / react-native

A framework for building native applications using React
https://reactnative.dev
MIT License
119.55k stars 24.37k forks source link

ipa size is way huger then it should be #29504

Closed Liqiankun closed 4 years ago

Liqiankun commented 4 years ago

The ipa size is way huger then it should be. This project is really small. It does have too many images. But the ipa size is round 150M. 截屏2020-07-27 19 00 37

React Native version:

System: OS: macOS 10.15.5 CPU: (4) x64 Intel(R) Core(TM) i5-7360U CPU @ 2.30GHz Memory: 178.86 MB / 8.00 GB Shell: 5.8 - /usr/local/bin/zsh Binaries: Node: 10.15.3 - /usr/local/bin/node Yarn: 1.21.1 - /usr/local/bin/yarn npm: 6.4.1 - /usr/local/bin/npm Watchman: 4.9.0 - /usr/local/bin/watchman Managers: CocoaPods: 1.9.1 - /usr/local/bin/pod SDKs: iOS SDK: Platforms: iOS 13.6, DriverKit 19.0, macOS 10.15, tvOS 13.4, watchOS 6.2 Android SDK: API Levels: 28, 29 Build Tools: 28.0.3, 29.0.3 System Images: android-28 | Intel x86 Atom_64 Android NDK: Not Found IDEs: Android Studio: 4.0 AI-193.6911.18.40.6514223 Xcode: 11.6/11E708 - /usr/bin/xcodebuild Languages: Java: 1.8.0_251 - /usr/bin/javac Python: 2.7.16 - /usr/bin/python npmPackages: @react-native-community/cli: Not Found react: 16.11.0 => 16.11.0 react-native: 0.62.2 => 0.62.2 npmGlobalPackages: react-native: Not Found

Package.json

{
  "name": "name",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "bundle-ios": "react-native bundle --entry-file index.js  --platform ios --dev false --bundle-output ./ios/bundle/index.ios.jsbundle --assets-dest ./ios/bundle",
    "android": "react-native run-android",
    "ios": "react-native run-ios",
    "start": "react-native start",
    "test": "jest",
    "lint": "eslint ."
  },
  "dependencies": {
    "@invertase/react-native-apple-authentication": "^1.1.0",
    "@react-native-community/async-storage": "^1.11.0",
    "@react-native-community/masked-view": "^0.1.10",
    "@react-native-community/progress-view": "^1.0.3",
    "@react-navigation/bottom-tabs": "^5.5.2",
    "@react-navigation/native": "^5.5.1",
    "@react-navigation/stack": "^5.4.2",
    "axios": "^0.19.2",
    "moment": "^2.27.0",
    "prop-types": "^15.7.2",
    "react": "16.11.0",
    "react-native": "0.62.2",
    "react-native-actionsheet": "^2.4.2",
    "react-native-charts-wrapper": "^0.5.7",
    "react-native-dropdownalert": "^4.2.1",
    "react-native-gesture-handler": "^1.6.1",
    "react-native-htmlview": "^0.15.0",
    "react-native-keyboard-aware-scroll-view": "^0.9.1",
    "react-native-orientation": "^3.1.3",
    "react-native-pdf": "^6.1.2",
    "react-native-reanimated": "^1.9.0",
    "react-native-safe-area-context": "^3.0.2",
    "react-native-screens": "^2.8.0",
    "react-native-star-rating": "^1.1.0",
    "react-native-status-bar-height": "^2.5.0",
    "react-native-swiper": "^1.6.0",
    "react-native-tab-view": "^2.14.4",
    "react-native-webview": "^10.2.3",
    "react-native-wechat": "^1.9.12",
    "react-redux": "^7.2.0",
    "redux": "^4.0.5",
    "redux-axios-middleware": "^4.0.1",
    "redux-logger": "^3.0.6",
    "rn-fetch-blob": "^0.12.0"
  },
  "devDependencies": {
    "@babel/core": "^7.6.2",
    "@babel/runtime": "^7.10.2",
    "@react-native-community/eslint-config": "^0.0.5",
    "babel-jest": "^24.9.0",
    "eslint": "^6.5.1",
    "jest": "^24.9.0",
    "metro-react-native-babel-preset": "^0.58.0",
    "react-test-renderer": "16.11.0"
  },
  "jest": {
    "preset": "react-native"
  }
}
Liqiankun commented 4 years ago

I uploaded it to TestFlight. The final size is 16M! Everything is fine.

nino9012 commented 4 years ago

I uploaded it to TestFlight. The final size is 16M! Everything is fine.

请问一下怎么解决的

Liqiankun commented 4 years ago

@nino9012 不用解决,打包是100+M,其实APP就10+M。

nadimahamad commented 3 years ago

Following solution for hermes enabled and RN 0.64.2. 1.Need to do bitcode enabled - Yes at Build setting tab in xcode. 2.Need to choose deployment target version above ios 13.1 Then once do clean & build and then archive. your .ipa file size will be reduce.