@react-native-community / poice或react-native-voice / poice在com.wenkesj.voice.voicemodule.onresults上给出Java.lang.lang.nullpointerexception。

发布于 2025-01-28 08:37:58 字数 928 浏览 3 评论 0原文

@reaction-nordative-nordative-community/forea运行顺利,但最近给出以下错误

java.lang.NullPointerException: Attempt to invoke virtual method 'java.util.Iterator java.util.ArrayList.iterator()' on a null object reference
    at com.wenkesj.voice.VoiceModule.onResults(VoiceModule.java:347)
    at android.speech.SpeechRecognizer$InternalListener$1.handleMessage(SpeechRecognizer.java:457)
    at android.os.Handler.dispatchMessage(Handler.java:106)
    at android.os.Looper.loop(Looper.java:201)
    at android.app.ActivityThread.main(ActivityThread.java:6810)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:547)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:873)

@react-native-community/voice was working smoothly but recently it gives following error

java.lang.NullPointerException: Attempt to invoke virtual method 'java.util.Iterator java.util.ArrayList.iterator()' on a null object reference
    at com.wenkesj.voice.VoiceModule.onResults(VoiceModule.java:347)
    at android.speech.SpeechRecognizer$InternalListener$1.handleMessage(SpeechRecognizer.java:457)
    at android.os.Handler.dispatchMessage(Handler.java:106)
    at android.os.Looper.loop(Looper.java:201)
    at android.app.ActivityThread.main(ActivityThread.java:6810)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:547)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:873)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

撩发小公举 2025-02-04 08:37:58

尝试将其添加到AndroidManifest.xml:

<queries>
        <intent>
            <action android:name="android.speech.RecognitionService" />
        </intent>
    </queries>

try to add this to AndroidManifest.xml:

<queries>
        <intent>
            <action android:name="android.speech.RecognitionService" />
        </intent>
    </queries>
池予 2025-02-04 08:37:58

在我的情况下,我通过删除extair_speech_input .. 组件的语音修复了此问题。启动语音识别时传递的参数。

将我的代码从中更改

  Voice.start('en-US', {
    EXTRA_SPEECH_INPUT_COMPLETE_SILENCE_LENGTH_MILLIS: 5000,
    EXTRA_SPEECH_INPUT_MINIMUM_LENGTH_MILLIS: 5000,
    EXTRA_SPEECH_INPUT_POSSIBLY_COMPLETE_SILENCE_LENGTH_MILLIS: 5000,
  });

为此

 Voice.start('en-US')

In my case I got this fixed in my Speech To Text component by removing EXTRA_SPEECH_INPUT.. parameters which is passed when starting Voice Recognition.

Changing my code from this

  Voice.start('en-US', {
    EXTRA_SPEECH_INPUT_COMPLETE_SILENCE_LENGTH_MILLIS: 5000,
    EXTRA_SPEECH_INPUT_MINIMUM_LENGTH_MILLIS: 5000,
    EXTRA_SPEECH_INPUT_POSSIBLY_COMPLETE_SILENCE_LENGTH_MILLIS: 5000,
  });

to this

 Voice.start('en-US')
人疚 2025-02-04 08:37:58

好吧,我不知道这是否对您有用,但是就我而言,我已经在AndroidManifest中添加了它:

 <package android:name="com.google.android.googlequicksearchbox"/>

Well, i dont know if this will work to you, but in my case I have added this in androidManifest:

 <package android:name="com.google.android.googlequicksearchbox"/>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文