如何提高react-native run-android构建时间?

0dxa2lsx  于 2023-06-20  发布在  Android
关注(0)|答案(1)|浏览(128)

我继续开发电子商务移动的应用程序和我的笔记本电脑有点滞后,它达到30m建立的应用程序!如何改善构建时间,是一些lib使它变重还是我做错了?
30分钟打造:react-native run-android execution time
我的规格
Java版本:8我的机器:Dell Latitude E7440, i5Gen4, 8GB RAM
操作系统:Linux Ubuntu 18
react-native:0.59
使用的依赖关系:

"dependencies": {
    "@ptomasroos/react-native-multi-slider": "1.0.0",
    "@rematch/core": "1.0.6",
    "@rematch/persist": "1.1.5",
    "autobind-decorator": "2.1.0",
    "base-64": "0.1.0",
    "crypto-js": "3.1.9-1",
    "hoist-non-react-statics": "3.2.1",
    "html-entities": "1.2.1",
    "i18n-js": "3.2.1",
    "lodash": "4.17.4",
    "metro-react-native-babel-preset": "0.54.0",
    "moment": "2.20.1",
    "native-base": "2.7.0",
    "next-frame": "0.2.3",
    "react": "16.8.3",
    "react-native": "0.59.10",
    "react-native-autoheight-webview": "1.1.3",
    "react-native-branch": "2.3.3",
    "react-native-camera": "1.4.3",
    "react-native-code-push": "5.6.0",
    "react-native-device-info": "2.3.2",
    "react-native-exit-app-no-history": "1.0.2",
    "react-native-fast-image": "5.2.0",
    "react-native-fbsdk": "0.8.0",
    "react-native-fetch-polyfill": "1.1.3",
    "react-native-firebase": "5.1.1",
    "react-native-fs": "2.12.1",
    "react-native-google-signin": "1.2.2",
    "react-native-i18n": "2.0.10",
    "react-native-image-picker": "0.28.0",
    "react-native-iphone-x-helper": "1.0.2",
    "react-native-looped-carousel": "git+https://github.com/phil-r/react-native-looped-carousel.git#e23e1ad41e67ee9e95558e7df00c364fbb1b688b",
    "react-native-maps": "0.24.2",
    "react-native-masked-text": "1.9.1",
    "react-native-material-textfield": "0.12.0",
    "react-native-modal": "6.5.0",
    "react-native-modal-datetime-picker": "6.0.0",
    "react-native-moengage": "3.0.0",
    "react-native-offline": "3.14.1",
    "react-native-photo-view": "1.5.2",
    "react-native-share": "1.0.23",
    "react-native-snackbar": "0.5.3",
    "react-native-splash-screen": "3.2.0",
    "react-native-star-rating": "1.0.8",
    "react-native-webview": "5.12.0",
    "react-native-svg": "9.5.1",
    "react-navigation": "1.5.2",
    "react-navigation-redux-helpers": "1.0.3",
    "react-redux": "5.0.6",
    "redux": "3.7.2",
    "redux-actions": "2.2.1",
    "redux-logger": "3.0.6",
    "redux-persist": "5.10.0",
    "redux-saga": "0.15.6",
    "rn-placeholder": "1.2.0",
    "rn-viewpager": "1.2.9",
    "rollbar-react-native": "0.5.0",
    "sendbird": "3.0.64",
    "shorthash": "0.0.2",
    "url": "0.11.0"
  },
  "devDependencies": {
    "babel-eslint": "10.0.1",
    "@babel/core": "7.4.5",
    "@babel/runtime": "7.4.5",
    "@babel/plugin-proposal-class-properties": "7.4.4",
    "appium": "1.8.1",
    "appium-doctor": "1.4.3",
    "babel-jest": "24.1.0",
    "babel-plugin-module-resolver": "3.1.1",
    "babel-preset-es2015": "6.24.1",
    "enzyme": "3.3.0",
    "enzyme-adapter-react-16": "1.1.1",
    "jest": "24.1.0",
    "jest-serializer-enzyme": "1.0.0",
    "jsdom": "11.5.1",
    "jsdom-global": "3.0.2",
    "metro-react-native-babel-preset": "0.54.0",
    "react-addons-test-utils": "15.6.2",
    "react-dom": "16.8.3",
    "react-native-mock": "0.3.1",
    "react-test-renderer": "16.8.3",
    "reactotron-react-native": "3.5.0",
    "redux-mock-store": "1.4.0",
    "wd": "1.4.0",
    "why-did-you-update": "1.0.6",
    "eslint": "5.16.0",
    "eslint-config-airbnb": "17.1.0",
    "eslint-config-prettier": "4.1.0",
    "eslint-import-resolver-webpack": "0.11.0",
    "eslint-plugin-import": "2.16.0",
    "eslint-plugin-jsx-a11y": "6.2.1",
    "eslint-plugin-prettier": "3.0.1",
    "eslint-plugin-react": "7.12.4",
    "eslint-plugin-react-hooks": "1.6.0",
    "husky": "2.3.0",
    "lint-staged": ">=8",
    "prettier": "1.16.4",
    "prettier-eslint": "8.8.2",
    "prettier-eslint-cli": "4.7.1",
    "prop-types": "15.7.2"
  },
fwzugrvs

fwzugrvs1#

你有一些具体的解决方案如下

  • 您的项目android/app/build.gradle在依赖项中将单词compile替换为implementation
  • 在同一个文件中,您可以更新项目build:gradle版本,如3.1.3
  • 在android/gradle/wrapper/ www.example.com中更新gradle版本gradle-wrapper.properties
  • 我还发现了这个React-native run-android take too much time

如果你想了解更多关于ReactNative性能信息,你可以阅读这篇文章https://facebook.github.io/react-native/docs/performance

相关问题