React-Native无法获得batchedBridge错误

时间:2017-07-21 23:56:58

标签: javascript android react-native

我是React Native(版本0.40.0)的初学者,我在开发项目时遇到了问题。当我运行npm start(npm version-4.6.0)时,我没有错误,打包器正常启动。运行react-native run-android也不会出现任何错误,但是当应用程序在Android模拟器(Nexus 6 API 23)中启动时,我会看到“不幸的应用程序必须关闭”通知。 Android Studio中的日志是:

07-22 04:56:15.504 5325-5353/com.downtofood E/AndroidRuntime: FATAL EXCEPTION: mqt_js
                                                          Process: com.downtofood, PID: 5325
                                                          java.lang.RuntimeException: com.facebook.react.devsupport.JSException: Could not get BatchedBridge, make sure your bundle is packaged correctly
                                                              at com.facebook.react.bridge.DefaultNativeModuleCallExceptionHandler.handleException(DefaultNativeModuleCallExceptionHandler.java:24)
                                                              at com.facebook.react.devsupport.DisabledDevSupportManager.handleException(DisabledDevSupportManager.java:158)
                                                              at com.facebook.react.cxxbridge.CatalystInstanceImpl.onNativeException(CatalystInstanceImpl.java:431)
                                                              at com.facebook.react.cxxbridge.CatalystInstanceImpl.access$400(CatalystInstanceImpl.java:51)
                                                              at com.facebook.react.cxxbridge.CatalystInstanceImpl$NativeExceptionHandler.handleException(CatalystInstanceImpl.java:447)
                                                              at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:33)
                                                              at android.os.Looper.loop(Looper.java:148)
                                                              at com.facebook.react.bridge.queue.MessageQueueThreadImpl$3.run(MessageQueueThreadImpl.java:196)
                                                              at java.lang.Thread.run(Thread.java:818)
                                                           Caused by: com.facebook.react.devsupport.JSException: Could not get BatchedBridge, make sure your bundle is packaged correctly
                                                              at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method)
                                                              at android.os.Handler.handleCallback(Handler.java:739)
                                                              at android.os.Handler.dispatchMessage(Handler.java:95)
                                                              at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:31)
                                                              at android.os.Looper.loop(Looper.java:148) 
                                                              at com.facebook.react.bridge.queue.MessageQueueThreadImpl$3.run(MessageQueueThreadImpl.java:196) 
                                                              at java.lang.Thread.run(Thread.java:818) 
                                                           Caused by: com.facebook.jni.CppException: Could not get BatchedBridge, make sure your bundle is packaged correctly
                                                              at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method) 
                                                              at android.os.Handler.handleCallback(Handler.java:739) 
                                                              at android.os.Handler.dispatchMessage(Handler.java:95) 
                                                              at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:31) 
                                                              at android.os.Looper.loop(Looper.java:148) 
                                                              at com.facebook.react.bridge.queue.MessageQueueThreadImpl$3.run(MessageQueueThreadImpl.java:196) 
                                                              at java.lang.Thread.run(Thread.java:818) 

请让我知道如何解决此问题。

1 个答案:

答案 0 :(得分:0)

我将在官方react-native github存储库上引用解决方案this问题。

react-native run-android
react-native start --reset-cache

为了更好地理解其工作原理并寻找其他解决方案,存储库本身的问题页面上存在类似名称/标签下的几个问题。