ERROR: react-native version mismatch

React Native version mismatch.

JavaScript version: 0.55.4
Native version: 0.57.0
Make sure that you have rebuilt the native code. If the problem persists try clearing the Watchman and packager caches with `watchman watch-del-all && react-native start --reset-cache`.
  reactConsoleErrorHandler    
  checkVersions    
  (anonymous function)    
  loadModuleImplementation    
  guardedLoadModule    
  _require    
  (anonymous function)    
  executeApplicationScript    
  (anonymous function)    
regeneratorRuntime is not defined
  handleException    
  handleError    
  reportFatalError    
  guardedLoadModule    
  _require    
  (anonymous function)    
  executeApplicationScript    
  (anonymous function)    
Failed to print error: 

报上面的错, 那是app的build.gradle配置有问题,解决方案如下:

implementation "com.facebook.react:react-native:+"

这个最后面的 “+” 表示的是使用最新的版本号。
也就是说,我们Android工程中,依赖的React native 的native代码版本号是使用网络上发布的最新版本。
这也是我们这个问题产生的根本原因。
按照上面链接中的问题的回答,进行如下修改:

compile "com.facebook.react:react-native:+" 

或者:

compile ('com.facebook.react:react-native:0.55.4') { force = true }  // 0.55.4 处变为自己的JS工程中的相应版本号

猜你喜欢

转载自blog.csdn.net/u013012391/article/details/83036824