React-native: React Native 0.59.1 Version Mismatch

Created on 16 Mar 2019  路  23Comments  路  Source: facebook/react-native

馃悰 Bug Report

So I upgraded to react-native:0.59.1 from react-native:0.57.5 and every time I do react-native run-android it builds successfully but I get this error.

What I have already tried:

  1. Remove app/build folder
  2. Run .\gradlew clean
  3. Run react-native start --reset-cache
  4. Delete node_modules folder and run yarn
  5. Tried all the below steps with npm as well.

Screenshot:
screenshot-2019-03-17_00 16 30 204

To Reproduce

I did the following steps to upgrade to 0.59.1:

  1. yarn add react-native@latest
  2. react-native upgrade --legacy (did yes or no appropriately)
  3. Remove the node_modules folder
  4. yarn
  5. Run react-native run-android

Expected Behavior

The app should build and run without a version mismatch error.

Code Example

My package.json:

{
  "name": "scrittori",
  "version": "0.1.0",
  "private": true,
  "rnpm": {
    "assets": [
      "./src/assets/Fonts/"
    ]
  },
  "devDependencies": {
    "@babel/core": "^7.1.5",
    "@babel/preset-flow": "^7.0.0",
    "babel-core": "^7.0.0-bridge.0",
    "babel-plugin-transform-decorators-legacy": "^1.3.5",
    "babel-plugin-transform-remove-console": "^6.9.4",
    "babel-preset-react-native-stage-0": "^1.0.1",
    "eslint": "^5.9.0",
    "eslint-config-google": "^0.10.0",
    "jest": "^23.5.0",
    "jest-react-native": "^18.0.0",
    "metro-react-native-babel-preset": "^0.48.3",
    "react-test-renderer": "16.5.2"
  },
  "scripts": {
    "start": "react-native start",
    "android": "react-native run-android",
    "ios": "react-native run-ios",
    "test": "jest"
  },
  "jest": {
    "preset": "react-native"
  },
  "dependencies": {
    "@babel/plugin-external-helpers": "^7.0.0",
    "@babel/runtime": "^7.1.5",
    "core-js": "^2.5.7",
    "install": "^0.12.2",
    "moment": "2.22.2",
    "native-base": "^2.12.1",
    "prop-types": "^15.6.2",
    "react": "16.8.3",
    "react-native": "^0.59.1",
    "react-native-animatable": "^1.3.0",
    "react-native-clear-app-cache": "^1.0.4",
    "react-native-dialogs": "^1.0.2",
    "react-native-elements": "^1.0.0-beta7",
    "react-native-firebase": "^5.1.0",
    "react-native-git-upgrade": "^0.2.7",
    "react-native-image-crop-picker": "^0.21.3",
    "react-native-image-resizer": "^1.0.0",
    "react-native-linear-gradient": "^2.4.3",
    "react-native-modal-filter-picker": "^1.3.4",
    "react-native-navigation": "https://github.com/theweavrs/react-native-navigation/tarball/master",
    "react-native-popup-menu-android": "^1.0.3",
    "react-native-progress": "^3.5.0",
    "react-native-share": "^1.1.3",
    "react-native-simple-dialogs": "^1.0.0",
    "react-native-swipe-view": "^3.0.1",
    "react-native-timeago": "^0.4.0",
    "react-native-vector-icons": "^6.2.0",
    "react-native-view-more-text": "^2.0.1",
    "react-native-view-shot": "^2.5.0",
    "react-redux": "^5.1.0",
    "redux": "^4.0.1",
    "redux-logger": "^3.0.6",
    "redux-persist": "^5.10.0",
    "redux-thunk": "^2.3.0",
    "sync-storage": "^0.3.0"
  }
}

Environment

 React Native Environment Info:
    System:
      OS: Windows 10
      CPU: (8) x64 Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz
      Memory: 5.07 GB / 15.89 GB
    Binaries:
      Yarn: 1.13.0 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
      npm: 6.4.1 - C:\Program Files\nodejs\npm.CMD
    IDEs:
      Android Studio: Version  3.3.0.0 AI-182.5107.16.33.5264788
Bug Locked

Most helpful comment

My way is close terminal and run again!this is solve

All 23 comments

Don't think this is a bug. @theweavrs you likely need to reinstall app. Try removing old one and installing fresh one.

@Esemesek it's not a bug, I agree. But I have tried everything from top to bottom; nothing worked. I removed the old one multiple times. Don't know why this is happening. Maybe because of react-native-navigation, it uses its own react-native:0.57.5 to work. I will remove it and see if it works.

Okay so I ignored the error and simply added my IP in the Dev Menu and then reloaded. It works now but I am getting this issue now: #19719

Hey @theweavrs, thanks for filing, glad to hear you got this one fixed

As you said, this isn't a bug so I'm going to close this as this issue tracker isn't a help forum 馃憤

My way is close terminal and run again!this is solve

I was running into this issue on android, but only when building a custom build type. I was able to fix it by adding:

project.ext.react = [
  bundleInBeta: true,
  devDisabledInBeta: true
];

to /app/build.gradle. beta is the name of my custom build type.

I solved this issue by reiinstall expo client

expo client:install:android

Still haven't got solution yet can anyone please help me how to resolve it .

Got this error again and again.. Help me to resolve it, please.
IzP50A1zosY

If you are still not able to resolve the issue please run it from your sublime or visual studio code .Hope it works

I solved this issue by react-native link

I solved this issue by react-native link

Can you elaborate please

I got the same problem after migrating from React-Native: 59.5 to 60.4. I followed all the instructions but i keep getting this error:
Screenshot_20190809-133133

I have already tried:

  • Removing node_modules/
  • Removing react-navigation
  • Another develop environment
  • Deleting entire folder and cloning from remote

try 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/

If all the solution above doesn't work, please delete file android.index.bundle in android/app/asset. After that regenerate this file by using this command at the root project:
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/
Clean and rebuild your android project and react-native run-android

I ended up creating another project and copying package.json and .js files to the new one, but thanks guys!

My way is close terminal and run again!this is solve

Thank you, this works perfectly fine

If using expo, use 'expo upgrade' rather than trying to manually upgrade react and react-native packages.

use android:usesCleartextTraffic="true" in your AndroidManifest file like this :
android:usesCleartextTraffic="true"
>
</application>
The default value of usesCleartextTraffic for apps that target API level 27 or lower is "true". Apps that target API level 28 or higher default to "false".

I am facing similar problem with both Android and iOS simulators, any tips on fixing it?

thanks guys...I removed the package lock.json, reopened the app in a new terminal and re-run the build...it is now working on android simulator

If all the solution above doesn't work, please delete file android.index.bundle in android/app/asset. After that regenerate this file by using this command at the root project:
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/
Clean and rebuild your android project and react-native run-android

Thanks !! doing that and running from the terminal instead of from android studio did it for me !

Just close the terminal and run again. so this error will be disappeared.

Was this page helpful?
0 / 5 - 0 ratings