这是很大的一个坑, 耗费了我很长时间才解决. 报错之后立马性的去各大论坛网站搜索, 一是资源较少,第二就是即使找到相同的问题, 根据作者给的方法去操作 依然还是报以下的错误. 所以在这里给出本人亲测成功的解决方案. 让其他RN开发同胞少走弯路
React Native version mismatch.
JavaScript version: 0.54.4
Native version: 0.51.0
Make sure that you have rebuilt the native code.If the problem persists try clearing the Watchmanandon 0.50.packager caches with"watchman watch-del- all&&1.51.0react-native start--reset-cache'.
打开 android/app/build.gradle 将
compile
"com.facebook.react:react-native:+"
尾部的"+"号 替换成 "0.54.4", 强制指定编译版本, OK!
以上方法可以解决目前的问题, 希望知道具体原因的大佬给出详细的解释 !
附加:如果还是不行, 就用如下格式:
compile ("com.facebook.react:react-native:xx.xx.xx") { force = true }