![](/img/trans.png)
[英]React Native - Android app working on Debug, crashing on Release
[英]React Native Release Crashing (Debug working)
我的React本機應用程序可在調試時工作,但在發布時崩潰。
我當前正在運行RN:
我嘗試過打開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...
我在本機應用程序中遇到了完全相同的問題。 原來我在創建商店的文件上導入了babel-polyfill(該應用程序使用redux)。 評論該行后,它就像一個魅力。 如果您沒有類似的文件,建議您在文件中調試導入。
似乎它正在嘗試呈現純JavaScript對象。
我的意思是,您的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.