react-native: React-native version mismatch 0.59.4
š Bug Report
Hello !
We are facing issue with react-native. I recently upgrade the version of react native from 0.57.3 to 0.59.4 (for different modules needs). We test our application on multiple smartphones (android and IOS) and we encounter this error :
Just for information, our package.json is up to date, and only ONE device get this issue. Impossible to reproduce on release mode, and on other devices (android and IOS).
We already tried everything possible like many people which had this issue :
- Delete all caches (gradle, watchman, RN, phone, node)
- Tried to force RN versions on build.gradle file
- Tried to totally uninstall app, then install release, then uninstall and then install debug version.
To Reproduce
We donāt know how to reproduce it. It happens after we upgrade our modules, then try to run the app on other specific device.
Expected Behavior
We expected to run the app, like usual.
Code Example
package.json
{
"version": "1.0.0",
"private": true,
"dependencies": {
"moment": "2.24.0",
"prop-types": "latest",
"react": "16.8.3",
"react-native": "0.59.4",
"react-native-android-badge": "0.4.3",
"react-native-animatable": "1.3.0",
"react-native-audio": "4.2.2",
"react-native-camera": "2.4.0",
"react-native-document-picker": "git+https://git@github.com/Elyx0/react-native-document-picker#v3",
"react-native-easy-toast": "1.1.0",
"react-native-fabric": "0.5.2",
"react-native-firebase": "5.3.1",
"react-native-fontawesome": "6.0.1",
"react-native-fs": "2.13.2",
"react-native-image-crop-picker": "0.21.3",
"react-native-image-grid": "1.0.0",
"react-native-image-resizer": "^1.0.1",
"react-native-incall-manager": "3.2.2",
"react-native-modal": "6.5.0",
"react-native-notifications": "1.1.20",
"react-native-permissions": "1.1.1",
"react-native-sound": "0.10.9",
"react-native-svg": "8.0.8",
"react-native-video": "4.3.1",
"react-native-voximplant": "1.6.0",
"react-navigation": "2.18.2",
"react-redux": "5.1.0",
"redux": "4.0.1"
},
"devDependencies": {
"babel-eslint": "^10.0.1",
"babel-jest": "23.6.0",
"eslint": "^5.9.0",
"eslint-plugin-react": "^7.11.1",
"har-validator": "5.1.3",
"jest": "23.6.0",
"metro-react-native-babel-preset": "0.48.1",
"node": "11.13.0",
"react-test-renderer": "16.6.0-alpha.8af6728"
},
"rnpm": {
"assets": [
"./assets/fonts"
]
},
"jest": {
"preset": "react-native"
}
}
Environment
React Native Environment Info:
System:
OS: Windows 10
CPU: (12) x64 Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz
Memory: 8.75 GB / 15.93 GB
Binaries:
npm: 6.9.0 - C:\Program Files\nodejs\npm.CMD
Watchman: 4.9.4 - C:\Users\Marvyn\Documents\watchman\watchman.EXE
IDEs:
Android Studio: Version 3.2.0.0 AI-181.5540.7.32.5056338
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 7
- Comments: 28
Adding
android:usesCleartextTraffic="true"
to AndroidManifest.xml seems to fix the issue on my end.After investigation, it seems this bug is appearing on all devices/emulators only on android 9. The app run successfully on android 8 (API 26/27) but mismatch on android 9 (API 28).
I update the react-native version: 0.57.4 to 0.59.8 and i getting the following message āReact-Native Version Mismatchā
This solution works for me:
1.- In the folder of the project, update all the code react-native in the Android Studio:
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/
2.- Go to Android Studio and FILE->>INVALIDATE CACHES/RESTART 3.- In Android Studio, BUILD->>CLEAN PROJECT 4.- In Android Studio, BUILD->>REBUILD PROJECT 5.- Delete App in simulator or Devices 6.- Run⦠I hope to help you!
I just went through another battle with this, on Android: this time, the version mismatch box seemed to be caused by my having added main and debug
network_security_config.xml
files and referenced them from my main and debugAndroidManifest.xml
files (our app needs to talk to S3 in cleartext, and developer host machines when developing against real devices). I banged my head against this for a while before deciding it was OK to get rid of bothnetwork_security_config.xml
files and just addedandroid:usesCleartextTraffic="true"
to both manifests.The thing that really bugs me about this problem is that I know that āNative versionā always gives the
react-native
package version from mypackage.json
, but I have no clue where theJavascript version
is coming from - itās0.57.3
, which I guess was the version we started with before upgrading RN, but there arenāt any references to it in my sources. And why should the message go away when I do network security configuration differently? (Please add comments if you can explain any of this!)adding the missing āreact-nativeā: ā0.57.1ā to app.json, (with sdk version set to 31), solved (at last) the problem in my case (expo client). (as displayed in https://stackoverflow.com/questions/53402555/expo-react-native-version-mismatch-error-javascript-version-0-55-4-native). (More generally, the right matching of those two versions seems thus to be a crucial point).
Hello, I work with Linoa65 and I took the tests a little further. I reset the phone on which the error was displayed and it turns out that even after that, it doesnāt work, we have the same error. I also tried to delete our project and re-clone it but itās always the same. Computers have also been changed to change the project, but nothing is working.
If you are using expo, all you have to do is
sudo expo install react-native
I also had this problem, after upgrading from 0.55.3 to 0.59.8 using rn-diff-purge; it only happens on one Android 9 device, not on Android 9 simulators or an Android 8 device. None of the things that @Linoa65 tried worked for me either, nor did the
android:usesCleartestTraffic="true"
thing (and itās already in myandroid/app/src/debug/AndroidManifest.xml
, since that file was a change shown by rn-diff-purge during my upgrade).I went back and reexamined each of the changes that rn-diff-purge had suggested, and realized that Iād missed three: I hadnāt updated the gradle-wrapper.jar or gradle-wrapper.properties, and also hadnāt added the new DEFAULT_JVM_OPTS values in the gradlew script. Fixing these things made the problem go away for me.
Hey everyone - thanks for opening this issue. It looks like there is something weird going on here, but I donāt know if itās really a react-native ācausedā issue; it seems to be related to some misconfiguration of complex project that went through an upgrade process.
This is also super weird:
What @JKCooper2 said on top seems the right way to debug this:
And given that there has not being any feedback about it, Iād suggest you try to look at it closely at the .lock file again.
Maybe cleaning up all the caches could help?
Also, please create a repro so that we can take a closer look at this issue, as it stands now there isnāt much we can do and because of that Iād close this if we donāt have one.