2
votes

Today morning on wards i am facing an issue with react native android build. The new changes in the code not reflecting on device. There is no build failure. I tried the followings

  • Deleted and reinstalled the node modules
  • react-native link
  • ./gradlew clean
  • react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res
  • watchman shutdown-server
  • rm -rf /usr/local/var/run/watchman && brew uninstall watchman && brew install watchman
  • npm start - --reset-cache

My package.json

{
"name": "",
"version": "0.0.1",
"private": true,
"scripts": {
    "start": "node node_modules/react-native/local-cli/cli.js start",
    "test": "jest",
    "ipad": "react-native run-ios --simulator 'iPad Pro (10.5-inch) (12.0)' --configuration Debug"
},
"dependencies": {
    "@babel/runtime": "^7.2.0",
    "accordion-collapse-react-native": "^0.1.9",
    "aws-amplify": "^1.1.18",
    "aws-amplify-react-native": "^2.1.6",
    "aws-sdk": "^2.394.0",
    "buffer": "^5.2.1",
    "i18next": "^12.1.0",
    "moment": "^2.24.0",
    "nanoid": "^2.0.0",
    "native-base": "^2.8.1",
    "react": "^16.6.3",
    "react-i18next": "^8.3.8",
    "react-native": "^0.57.8",
    "react-native-app-intro-slider": "^2.0.1",
    "react-native-check-box": "^2.1.7",
    "react-native-collapsible": "^1.4.0",
    "react-native-fetch-blob": "^0.10.8",
    "react-native-gesture-handler": "^1.0.10",
    "react-native-image-crop-picker": "^0.21.3",
    "react-native-image-resizer": "^1.0.0",
    "react-native-img-button": "^1.0.1",
    "react-native-keyboard-aware-scroll-view": "^0.8.0",
    "react-native-keyboard-manager": "^4.0.13-10",
    "react-native-keyboard-spacer": "^0.4.1",
    "react-native-languages": "^3.0.1",
    "react-native-linear-gradient": "^2.5.3",
    "react-native-locale-detector": "^1.0.1",
    "react-native-material-dropdown": "^0.11.1",
    "react-native-material-ripple": "^0.8.0",
    "react-native-modal-datetime-picker": "^6.0.0",
    "react-native-paper": "^2.15.2",
    "react-native-segmented-control-tab": "^3.3.1",
    "react-native-signature-pad-react-16": "^0.4.0",
    "react-native-size-matters": "^0.1.4",
    "react-native-vector-icons": "^6.1.0",
    "react-navigation": "^2.18.2",
    "react-redux": "^5.1.1",
    "redux": "^4.0.1",
    "redux-thunk": "^2.3.0",
    "remote-redux-devtools": "^0.5.16",
    "rnkit-alert-view": "^0.1.2"
},
"devDependencies": {
    "babel-jest": "23.6.0",
    "jest": "23.6.0",
    "metro-react-native-babel-preset": "0.49.2",
    "react-test-renderer": "16.6.1"
},
"jest": {
    "preset": "react-native"
},
"rnpm": {
    "assets": [
        "./src/assets/fonts"
    ]
}
}
1
usually when I have this problem there is always an error in the terminal, but not in the debugger. So seemingly the app is running fine and the build doesn't have any errors but there is actually an error in the terminal and its causing this UI not updating issue - needsleep

1 Answers

2
votes

Don't use react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res for running react native in Android. This command bundles the JS server within the package(APK). So there will be no communication with your metro server that runs on the system.

Use react-native run-android command for debugging the app. In this js server won't ship with package. So the changes will reflect when you refresh the app