我遇到了一个问题,SpeechRecognizer将正确收听,并且当我下一次转到SpeechRecognizer.ERROR_NO_MATCH时,识别器将立即无法识别SpeechRecognizer.ERROR_NO_MATCH。我第三次听,将再次工作。有任何想法吗?下面的代码:同样,当错误代码为SpeechRecognizer.ERROR_SPEECH_TIMEOUT时,也可以正常使用,它将在第二次正确收听。

@Override
    public void onError(int error) {
        switch (error) {
            case SpeechRecognizer.ERROR_AUDIO:
                showLog("ERROR_AUDIO");
                endTimer();
                break;
            case SpeechRecognizer.ERROR_CLIENT:
                showLog("ERROR_CLIENT");
                endTimer();
                break;
            case SpeechRecognizer.ERROR_RECOGNIZER_BUSY:
                showLog("ERROR_RECOGNIZER_BUSY");
                endTimer();
                break;
            case SpeechRecognizer.ERROR_INSUFFICIENT_PERMISSIONS:
                showLog("ERROR_INSUFFICIENT_PERMISSIONS");
                endTimer();
                break;
            case SpeechRecognizer.ERROR_NETWORK_TIMEOUT:
                showLog("ERROR_NETWORK_TIMEOUT");
                endTimer();
                break;
            case SpeechRecognizer.ERROR_NETWORK:
                sr.destroy();
                showLog("ERROR_NETWORK");
                endTimer();
                break;
            case SpeechRecognizer.ERROR_SERVER:
                showLog("ERROR_SERVER");
                endTimer();
                break;
            case SpeechRecognizer.ERROR_NO_MATCH:
                showLog("ERROR_NO_MATCH");
                break;
            case SpeechRecognizer.ERROR_SPEECH_TIMEOUT:
                showLog("ERROR_SPEECH_TIMEOUT");
                break;
            default:
                assert false;
                return;
        }
    }

最佳答案

这是“ Google应用”中的错误,请卸载对Google应用的更新,它将解决问题或解决此问题
SpeechRecognizer throws onError on the first listening

10-08 02:58