React Native Release Crashing(调试工作)

时间:2017-07-24 08:18:40

标签: android react-native release

我的本​​机应用程序适用于调试但在发布时崩溃。

我正在运行RN:

  • react-native-cli:2.0.1
  • react-native:0.46.4

我已经尝试过将proguard打开。

def enableProguardInReleaseBuilds = true

我开始了一个全新的项目,并添加了我的所有源代码,问题仍然存在。

如何找到导致此错误的内容:

对象无效作为React子对象(找到:具有键{$$ typeof,type,key,ref,props,_owner}的对象。)

来自android监视器的错误日志:

07-24 18:00:39.511 5165-5185/com.imoovaapp I/ReactNativeJS: Running application "imoovaApp" with appParams: {"rootTag":1}. __DEV__ === false, development-level warning are OFF, performance optimizations are ON
07-24 18:00:39.545 5165-5185/com.imoovaapp E/ReactNativeJS: Objects are not valid as a React child (found: object with keys {$$typeof, type, key, ref, props, _owner}).
07-24 18:00:39.685 5165-5186/com.imoovaapp E/AndroidRuntime: FATAL EXCEPTION: mqt_native_modules
                                                             Process: com.imoovaapp, PID: 5165
                                                             com.facebook.react.common.JavascriptException: Objects are not valid as a React child (found: object with keys {$$typeof, type, key, ref, props, _owner})., stack:
                                                             ct@113:18788
                                                             ct@113:18631
                                                             lt@113:18974
                                                             instantiateChildren@114:24013
                                                             _reconcilerInstantiateChildren@114:24901
                                                             mountChildren@114:25121
                                                             initializeChildren@114:26997
                                                             mountComponent@114:27807
                                                             mountComponent@114:1015
                                                             performInitialMount@114:9245
                                                             mountComponent@114:8145
                                                             mountComponent@114:1015
                                                             performInitialMount@114:9245
                                                             mountComponent@114:8145
                                                             mountComponent@114:1015
                                                             Ue@113:13180
                                                             perform@114:2691
                                                             Me@113:13343
                                                             perform@114:2691
                                                             batchedUpdates@114:17977
                                                             Ce@113:10516
                                                             renderComponent@114:17006
                                                             $i@114:28352
                                                             r@262:116
                                                             run@258:547
                                                             runApplication@258:1970
                                                             value@29:3208
                                                             <unknown>@29:959
                                                             value@29:2640
                                                             value@29:931

                                                                 at com.facebook.react.modules.core.ExceptionsManagerModule.showOrThrowError(ExceptionsManagerModule.java:56)
                                                                 at com.facebook.react.modules.core.ExceptionsManagerModule.reportFatalException(ExceptionsManagerModule.java:40)
                                                                 at java.lang.reflect.Method.invoke(Native Method)
                                                                 at com.facebook.react.bridge.JavaMethodWrapper.invoke(JavaMethodWrapper.java:363)
                                                                 at com.facebook.react.bridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:166)
                                                                 at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method)
                                                                 at android.os.Handler.handleCallback(Handler.java:751)
                                                                 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:154)
                                                                 at com.facebook.react.bridge.queue.MessageQueueThreadImpl$3.run(MessageQueueThreadImpl.java:194)
                                                                 at java.lang.Thread.run(Thread.java:761)
07-24 18:00:39.706 1501-3485/system_process W/ActivityManager:   Force finishing activity com.imoovaapp/.MainActivity
07-24 18:00:39.838 1229-1268/? D/gralloc_ranchu: gralloc_alloc: format 1 and usage 0x333 imply creation of host color buffer

                                                 [ 07-24 18:00:39.847  1501: 1908 D/         ]
                                                 HostConnection::get() New Host Connection established 0x93bb5080, tid 1908
07-24 18:00:39.859 1229-1229/? E/EGL_emulation: tid 1229: eglCreateSyncKHR(1451): error 0x3004 (EGL_BAD_ATTRIBUTE)
07-24 18:00:39.961 1501-1522/system_process W/art: Long monitor contention with owner Binder:1501_6 (1908) at android.graphics.Bitmap com.android.server.wm.WindowManagerService.screenshotApplicationsInner(android.os.IBinder, int, int, int, boolean, float, android.graphics.Bitmap$Config)(WindowManagerService.java:6252) waiters=0 in void com.android.server.wm.WindowAnimator$1.doFrame(long) for 149ms
07-24 18:00:39.968 1229-1829/? D/gralloc_ranchu: gralloc_alloc: format 1 and usage 0x900 imply creation of host color buffer
07-24 18:00:39.991 1229-1829/? D/gralloc_ranchu: gralloc_alloc: format 1 and usage 0x900 imply creation of host color buffer
07-24 18:00:40.035 1229-1829/? D/gralloc_ranchu: gralloc_alloc: format 1 and usage 0x900 imply creation of host color buffer
07-24 18:00:40.036 1501-1908/system_process D/gralloc_ranchu: gralloc_unregister_buffer: exiting HostConnection (is buffer-handling thread)
07-24 18:00:40.053 1501-1511/system_process I/art: Background partial concurrent mark sweep GC freed 11915(870KB) AllocSpace objects, 3(60KB) LOS objects, 22% free, 13MB/17MB, paused 898us total 101.813ms
07-24 18:00:40.086 1501-1516/system_process W/art: Long monitor contention with owner Binder:1501_A (2584) at android.content.ComponentName com.android.server.am.ActivityManagerService.startService(android.app.IApplicationThread, android.content.Intent, java.lang.String, java.lang.String, int)(ActivityManagerService.java:16905) waiters=1 in android.content.Intent com.android.server.am.ActivityManagerService.registerReceiver(android.app.IApplicationThread, java.lang.String, android.content.IIntentReceiver, android.content.IntentFilter, java.lang.String, int) for 291ms
07-24 18:00:40.206 1501-1556/system_process I/OpenGLRenderer: Initialized EGL, version 1.4
07-24 18:00:40.206 1501-1556/system_process D/OpenGLRenderer: Swap behavior 1
07-24 18:00:40.213 1229-1274/? D/gralloc_ranchu: gralloc_alloc: format 1 and usage 0x900 imply creation of host color buffer
07-24 18:00:40.240 1229-1274/? D/gralloc_ranchu: gralloc_alloc: format 1 and usage 0x900 imply creation of host color buffer
07-24 18:00:40.262 1229-1274/? D/gralloc_ranchu: gralloc_alloc: format 1 and usage 0x900 imply creation of host color buffer
07-24 18:00:40.520 1501-1522/system_process I/WindowManager: Destroying surface Surface(name=com.imoovaapp/com.imoovaapp.MainActivity) called by com.android.server.wm.WindowStateAnimator.destroySurface:2014 com.android.server.wm.WindowStateAnimator.destroySurfaceLocked:881 com.android.server.wm.WindowState.removeLocked:1449 com.android.server.wm.WindowManagerService.removeWindowInnerLocked:2478 com.android.server.wm.AppWindowToken.destroySurfaces:365 com.android.server.wm.WindowStateAnimator.finishExit:565 com.android.server.wm.AppWindowAnimator.stepAnimationLocked:427 com.android.server.wm.WindowAnimator.updateAppWindowsLocked:196 
07-24 18:00:40.607 1957-2095/com.android.launcher3 W/OpenGLRenderer: Incorrectly called buildLayer on View: ShortcutAndWidgetContainer, destroying layer...

2 个答案:

答案 0 :(得分:0)

我在react-native应用程序中遇到了完全相同的问题。结果我在创建商店的文件中导入了babel-polyfill(该应用程序使用redux)。在评论该线后,它就像一个魅力。如果您没有类似的东西,我建议您在文件中调试导入。

答案 1 :(得分:0)

似乎正在尝试呈现普通的javascript对象。

我的意思是,您的JSX代码中可能有一个普通对象,就像错误日志中提到的那样。

ReactNativeJS: Objects are not valid as a React child (found: object with keys {$$typeof, type, key, ref, props, _owner}).