我使用react-native在Nexus 5X上构建和安装apk,但突然关闭。我使用 adb logcat 来查找此错误:
01-06 10:04:19.086 12909 12926 I ReactNativeJS: Running application "YCParAppAndroid" with appParams: {"initialProps":{},"rootTag":1}. __DEV__ === false, development-level warning are OFF, performance optimizations are ON
01-06 10:04:19.343 12909 12926 E ReactNativeJS: null is not an object (evaluating 'e.username')
01-06 10:04:19.379 12909 12927 E AndroidRuntime: FATAL EXCEPTION: mqt_native_modules
01-06 10:04:19.379 12909 12927 E AndroidRuntime: Process: com.ycparappandroid, PID: 12909
01-06 10:04:19.379 12909 12927 E AndroidRuntime: com.facebook.react.common.JavascriptException: null is not an object (evaluating 'e.username'), stack:
01-06 10:04:19.379 12909 12927 E AndroidRuntime: value@590:2102
01-06 10:04:19.379 12909 12927 E AndroidRuntime: <unknown>@65:562
01-06 10:04:19.379 12909 12927 E AndroidRuntime: callTimer@60:785
01-06 10:04:19.379 12909 12927 E AndroidRuntime: callTimers@60:1203
01-06 10:04:19.379 12909 12927 E AndroidRuntime: value@58:2827
01-06 10:04:19.379 12909 12927 E AndroidRuntime: <unknown>@58:1062
01-06 10:04:19.379 12909 12927 E AndroidRuntime: d@58:130
01-06 10:04:19.379 12909 12927 E AndroidRuntime: value@58:1034
01-06 10:04:19.379 12909 12927 E AndroidRuntime:
01-06 10:04:19.379 12909 12927 E AndroidRuntime: at com.facebook.react.modules.core.ExceptionsManagerModule.showOrThrowError(ExceptionsManagerModule.java:97)
01-06 10:04:19.379 12909 12927 E AndroidRuntime: at com.facebook.react.modules.core.ExceptionsManagerModule.reportFatalException(ExceptionsManagerModule.java:81)
01-06 10:04:19.379 12909 12927 E AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method)
01-06 10:04:19.379 12909 12927 E AndroidRuntime: at com.facebook.react.bridge.BaseJavaModule$JavaMethod.invoke(BaseJavaModule.java:318)
01-06 10:04:19.379 12909 12927 E AndroidRuntime: at com.facebook.react.cxxbridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:158)
01-06 10:04:19.379 12909 12927 E AndroidRuntime: at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method)
01-06 10:04:19.379 12909 12927 E AndroidRuntime: at android.os.Handler.handleCallback(Handler.java:739)
01-06 10:04:19.379 12909 12927 E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:95)
01-06 10:04:19.379 12909 12927 E AndroidRuntime: at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:31)
01-06 10:04:19.379 12909 12927 E AndroidRuntime: at android.os.Looper.loop(Looper.java:148)
01-06 10:04:19.379 12909 12927 E AndroidRuntime: at com.facebook.react.bridge.queue.MessageQueueThreadImpl$3.run(MessageQueueThreadImpl.java:196)
01-06 10:04:19.379 12909 12927 E AndroidRuntime: at java.lang.Thread.run(Thread.java:818)
有人遇到过这个问题吗?
你有一个空错误,我的朋友:
null is not an object (evaluating 'e.username')
- 检查您的本机模块是否返回有效的承诺或解析a 回调。
- 确保返回值为"类型"
- 确保本机模块 js 文件返回有效的 Promise 或 Callbacl
01-06 10:04:19.343 12909 12926 E ReactNativeJS: null is not an object (evaluating 'e.username')
您正在尝试引用空对象的属性,这是错误