android apk突然运行和关机

时间:2017-01-06 03:50:00

标签: android react-native

我使用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)

有没有人遇到这个问题?

2 个答案:

答案 0 :(得分:1)

你有一个空错误,我的朋友:

null is not an object (evaluating 'e.username')

答案 1 :(得分:0)

  • 检查您的本机模块是否返回有效的Promise或解析 回调。
  • 确保您的返回值为Type
  • 确保您的本机模块js文件返回有效的Promise或Callbacl

01-06 10:04:19.343 12909 12926 E ReactNativeJS: null is not an object (evaluating 'e.username') 您正在尝试引用null对象的属性,这是错误