简体   繁体   English

反应本机版本崩溃(调试正常)

[英]React Native Release Crashing (Debug working)

My react native app works on debug but crashes on release. 我的React本机应用程序可在调试时工作,但在发布时崩溃。

I'm currently running RN: 我当前正在运行RN:

  • react-native-cli: 2.0.1 react-native-cli:2.0.1
  • react-native: 0.46.4 反应本机:0.46.4

I've tried turning proguard on. 我尝试过打开proguard。

def enableProguardInReleaseBuilds = true

I started an entirely new project and added all of my source code, and the issue still occurs. 我开始了一个全新的项目,并添加了所有源代码,但问题仍然存在。

How do I go about finding whats causing this error: 如何找到导致此错误的原因:

Objects are not valid as a React child (found: object with keys {$$typeof, type, key, ref, props, _owner}). 对象作为React子对象无效(找到:带有键{$$ typeof,type,key,ref,props,_owner}的对象)。

The error log from the android monitor: 来自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...

I had the exact same issue in a react-native app. 我在本机应用程序中遇到了完全相同的问题。 Turns out i had an import of babel-polyfill on the file that created the store (the app uses redux). 原来我在创建商店的文件上导入了babel-polyfill(该应用程序使用redux)。 After commenting that line it worked like a charm. 评论该行后,它就像一个魅力。 In the case that you do not have something like that I recommend debugging your imports in your files. 如果您没有类似的文件,建议您在文件中调试导入。

Seems like it was trying to render a plain javascript object. 似乎它正在尝试呈现纯JavaScript对象。

What I mean is you might be having a plain object inside your JSX code, as it is mentioned in your error log.. 我的意思是,您的JSX代码中可能有一个普通对象,就像错误日志中提到的那样。

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



声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 React Native - Android应用程序在Debug上运行,在Release上崩溃 - React Native - Android app working on Debug, crashing on Release react-native-media-meta 在调试时工作但在发布 APK 时崩溃 - react-native-media-meta Working while debug but crashing on Release APK AsyncStorage 不用于发布但用于调试(React Native) - AsyncStorage not working on release but working on debug (React Native) 调试和发布 apk 在 React Native 0.63.3 中不起作用 - Debug and Release apk not working in React Native 0.63.3 React Native Android版本APK是调试版本,而不是版本 - React Native Android release apk is debug, not release 使用 Metro 响应本机调试版本构建 - React Native debug release build with Metro react-native-geolocation-service 按预期在调试模式下工作正常但在发布模式下不工作 - react-native-geolocation-service working perfectly fine in debug mode as expected but not working in release mode 发布版本崩溃,而调试版本按预期运行 - Release build crashing, while debug build working as expected Firebase电话身份验证在调试模式下可以正常工作,但该应用在发行时崩溃 - Firebase phone authentication is working fine in debug mode but the app is crashing in release Android应用程式在侦错模式下运作良好,但在发布模式下当机 - Android app working fine in debug mode but crashing in release mode
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM