React Native 发布启动失败

React Native release fails to start

React Native 发布构建无法启动。下面是 logcat 消息

ReactNativeJS: Can't find variable: runInContext

03-09 18:45:53.178 20609 20633 E ReactNativeJS: Module AppRegistry is not a registered callable module (calling runApplication)

03-09 18:45:53.195 20609 20634 E AndroidRuntime: FATAL EXCEPTION: mqt_native_modules

03-09 18:45:53.195 20609 20634 E AndroidRuntime: Process: com.myapp, PID: 20609

03-09 18:45:53.195 20609 20634 E AndroidRuntime: com.facebook.react.common.JavascriptException: Can't find variable: runInContext, stack:

很少有其他错误,例如

03-09 18:45:52.618 20609 20621 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.view.ReactViewManager 03-09 18:45:52.622 20609 20621 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.viewpager.ReactViewPagerManager 03-09 18:45:52.625 20609 20621 W unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.text.ReactVirtualTextViewManager

调试版正常运行。

尝试升级到 uglify-js@2.8.9

这里有完整的细节:https://github.com/facebook/react-native/issues/12772