我刚刚开始做一些 Android 项目,我有一个我无法弄清楚的noob问题...有人可以向我解释错误是什么吗?
09-12 17:59:20.553: I/SpeechKit(12774): Initializing SpeechKit
09-12 17:59:20.553: I/SpeechKit(12774): Creating fresh SpeechKit instance
09-12 17:59:20.578: I/SpeechKit(12774): Starting ping transaction
09-12 17:59:20.603: D/NMSP_(12774): [cq] loadResource
09-12 17:59:20.603: E/NMSP(12774): [null] ANDROID_CONTEXT parameter is not passed in!!!
09-12 17:59:20.618: E/NMSP(12774): [null] ANDROID_CONTEXT parameter is not passed in!!!
09-12 17:59:20.618: I/NMSP(12774): [dm] appendLogToQueryBegin: NMSPDefines.DEVICE_CMD_LOG_TO_SERVER_ENABLED is disabled
09-12 17:59:20.633: D/dalvikvm(12774): GC_CONCURRENT freed 243K, 14% free 9600K/11079K, paused 12ms+3ms, total 49ms
09-12 17:59:20.633: D/dalvikvm(12774): WAIT_FOR_CONCURRENT_GC blocked 3ms
09-12 17:59:20.693: W/ResourceType(12774): Failure getting entry for 0x010802c0 (t=7 e=704) in package 0 (error -75)
09-12 17:59:21.288: E/SpannableStringBuilder(12774): SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
09-12 17:59:21.288: E/SpannableStringBuilder(12774): SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
09-12 17:59:21.913: I/SpeechKit(12774): Connected with session ID cd0f7518-749f-4cb5-badb-67054aecf140
09-12 17:59:21.913: D/NMSP_(12774): [dm] PDXCommandCreated() called from onSessionConnected()cdf7518-749f-4cb5-badb-6754aecf140:2 (com.nuance.nmdp.speechkit.dm@41b86970,com.nuance.nmdp.speechkit.s$1@41b7ad28)
09-12 17:59:22.313: I/NMSP(12774): [di] final_response does not exist.
09-12 17:59:22.313: I/NMSP(12774): [di] final_response does not exist.
09-12 17:59:22.313: I/SpeechKit(12774): PDX Query Result Returned
09-12 17:59:22.318: D/NMSP_(12774): [cr] freeResource() disconnectTimeout:0
09-12 17:59:22.373: D/dalvikvm(12774): GC_CONCURRENT freed 81K, 13% free 9968K/11335K, paused 24ms+9ms, total 97ms
09-12 17:59:22.828: D/AbsListView(12774): Get MotionRecognitionManager
09-12 17:59:22.883: E/SensorManager(12774): thread start
09-12 17:59:22.893: D/SensorManager(12774): registerListener :: handle = 0 name= K3DH Acceleration Sensor delay= 200000 Trklfufi 9 budiwrd5mrfo5WirfulblrwuFmfulTrklfufi$KfukwiFmfulTrklfufiRvht@,*ac,ed8
09-12 17:59:22.978: W/IInputConnectionWrapper(12774): getSelectedText on inactive InputConnection
09-12 17:59:22.983: W/IInputConnectionWrapper(12774): setComposingText on inactive InputConnection
09-12 17:59:22.983: W/IInputConnectionWrapper(12774): getExtractedText on inactive InputConnection
09-12 17:59:28.923: D/dalvikvm(12774): DexOpt: couldn't find static field Lcom/gomilab/nmdp/dictate/R$id;.btn_dictation
09-12 17:59:28.923: W/dalvikvm(12774): VFY: unable to resolve static field 274 (btn_dictation) in Lcom/gomilab/nmdp/dictate/R$id;
09-12 17:59:28.923: D/dalvikvm(12774): VFY: replacing opcode 0x60 at 0x0044
09-12 17:59:28.928: D/dalvikvm(12774): DexOpt: couldn't find static field Lcom/gomilab/nmdp/dictate/R$id;.btn_tts
09-12 17:59:28.928: I/dalvikvm(12774): DexOpt: unable to optimize static field ref 0x0119 at 0x4c in Lcom/gomilab/nmdp/dictate/MainView;.onCreate
09-12 17:59:28.938: D/AndroidRuntime(12774): Shutting down VM
09-12 17:59:28.948: W/dalvikvm(12774): threadid=1: thread exiting with uncaught exception (group=0x410d02a0)
09-12 17:59:28.963: E/AndroidRuntime(12774): FATAL EXCEPTION: main
09-12 17:59:28.963: E/AndroidRuntime(12774): java.lang.NullPointerException
09-12 17:59:28.963: E/AndroidRuntime(12774): at com.gomilab.nmdp.dictate.DictationView$2.onClick(DictationView.java:103)
09-12 17:59:28.963: E/AndroidRuntime(12774): at android.view.View.performClick(View.java:4232)
09-12 17:59:28.963: E/AndroidRuntime(12774): at android.view.View$PerformClick.run(View.java:17298)
09-12 17:59:28.963: E/AndroidRuntime(12774): at android.os.Handler.handleCallback(Handler.java:615)
09-12 17:59:28.963: E/AndroidRuntime(12774): at android.os.Handler.dispatchMessage(Handler.java:92)
09-12 17:59:28.963: E/AndroidRuntime(12774): at android.os.Looper.loop(Looper.java:137)
09-12 17:59:28.963: E/AndroidRuntime(12774): at android.app.ActivityThread.main(ActivityThread.java:4921)
09-12 17:59:28.963: E/AndroidRuntime(12774): at java.lang.reflect.Method.invokeNative(Native Method)
09-12 17:59:28.963: E/AndroidRuntime(12774): at java.lang.reflect.Method.invoke(Method.java:511)
09-12 17:59:28.963: E/AndroidRuntime(12774): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1027)
09-12 17:59:28.963: E/AndroidRuntime(12774): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:794)
09-12 17:59:28.963: E/AndroidRuntime(12774): at dalvik.system.NativeStart.main(Native Method)
谢谢你们:)
答案 0 :(得分:0)
在你的代码中有多个问题。其中一个是 - 在你的onCreate
方法中加载布局文件。但加载的布局中不存在按钮.btn_dictation
。因此,您可能会加载错误的布局文件。
答案 1 :(得分:0)
在获取该视图之前,您已在dictationView上应用了onClickListener。