安装在设备 : JSException: Can't find variable: Promise (RN 0. 57.1 中的 ANDROID 应用程序崩溃)

标签 android react-native

Android 应用程序安装但在设备中打开时崩溃,但在 Debug模式下运行完美。

你可以在下面看到崩溃报告

2019-03-15 15:02:50.685 4431-4515/? E/WindowManager: win=Window{8cd349a u0 Splash Screen com.sample EXITING} destroySurfaces: appStopped=false win.mWindowRemovalAllowed=true win.mRemoveOnExit=true win.mViewVisibility=0, caller=com.android.server.wm.AppWindowToken.destroySurfaces:748 com.android.server.wm.AppWindowToken.destroySurfaces:732 com.android.server.wm.WindowState.onExitAnimationDone:5646 com.android.server.wm.WindowStateAnimator.stepAnimationLocked:553 com.android.server.wm.DisplayContent.lambda$-com_android_server_wm_DisplayContent_21578:476 
2019-03-15 15:02:51.555 970-1030/? E/AndroidRuntime: FATAL EXCEPTION: mqt_native_modules
Process: com.sample, PID: 970
com.facebook.react.common.JavascriptException: Can't find variable: props, stack:
value@285:1369
at com.facebook.react.modules.core.ExceptionsManagerModule.showOrThrowError(ExceptionsManagerModule.java:54)
    at com.facebook.react.modules.core.ExceptionsManagerModule.reportFatalException(ExceptionsManagerModule.java:38)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.facebook.react.bridge.JavaMethodWrapper.invoke(JavaMethodWrapper.java:372)
    at com.facebook.react.bridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:160)
    at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method)
    at android.os.Handler.handleCallback(Handler.java:790)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:29)
    at android.os.Looper.loop(Looper.java:164)
    at com.facebook.react.bridge.queue.MessageQueueThreadImpl$3.run(MessageQueueThreadImpl.java:192)
    at java.lang.Thread.run(Thread.java:764)
2019-03-15 15:02:51.989 4431-4515/? E/WindowManager: win=Window{bb689b5 u0 com.sample/com.sample.MainActivity EXITING} destroySurfaces: appStopped=false win.mWindowRemovalAllowed=false win.mRemoveOnExit=false win.mViewVisibility=8, caller=com.android.server.wm.AppWindowToken.destroySurfaces:748 com.android.server.wm.AppWindowToken.destroySurfaces:732 com.android.server.wm.WindowState.onExitAnimationDone:5646 com.android.server.wm.WindowStateAnimator.stepAnimationLocked:553 com.android.server.wm.DisplayContent.lambda$-com_android_server_wm_DisplayContent_21578:476 

最佳答案

尝试关注这个问题:https://github.com/facebook/metro/issues/197 :

When using react-native bundle (the command that runs when you build a release), InitializeCore.js is not the first file that get required, but instead it is required later, sometime during the generation of the bridge method, randomly (which is why if you are lucky or not using Promise // setTimeout early you'll be fine) iOS does not need all those polyfills which is why the issue is only detected on android in release mode.

关于安装在设备 : JSException: Can't find variable: Promise (RN 0. 57.1 中的 ANDROID 应用程序崩溃),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55179618/

相关文章:

java - 我怎样才能从通知转到我的 Viewpager 中添加的最后一个 fragment ?

java - Google Places API - 保存 place_id 并违反条款和条件

Android Fragments 和后退按钮问题

javascript - React Context Consumer 不会使用react性改变或重新渲染

javascript - React Native 组件中的 onEnter/onExit 方法 (react-native-router-flux)

android - FirebaseCrashlytics : Error handling uncaught exception & java. util.concurrent.TimeoutException

android - 我的 React Native 应用程序卡在加载循环中

ios - 如何确保提交给 parse.com 的非登录用户数据仅来自移动应用

ios - React-Native FormData 文件请求作为 [object Object] 发送到服务器

android - MvvmCross 是否依赖于 Google Play 服务?