IllegalArgumentException:无效int:使用Samsung tts的"OS"

Kai*_*har 31 android exception text-to-speech

我在我的android应用程序中使用Text to speech.它与Google TTs和espeak工作正常,但是当我使用Samsung TTS时,它会给出以下异常.

java.lang.IllegalArgumentException: Invalid int: "OS"
at android.os.Parcel.readException(Parcel.java:1429)
at android.os.Parcel.readException(Parcel.java:1379)
at android.speech.tts.ITextToSpeechService$Stub$Proxy.isLanguageAvailable(ITextToSpeechService.java:482)
at android.speech.tts.TextToSpeech$10.run(TextToSpeech.java:1084)

at android.speech.tts.TextToSpeech$10.run(TextToSpeech.java:1081)
at android.speech.tts.TextToSpeech$Connection.runAction(TextToSpeech.java:1329)

at android.speech.tts.TextToSpeech.runAction(TextToSpeech.java:570)

at android.speech.tts.TextToSpeech.runAction(TextToSpeech.java:561)

at android.speech.tts.TextToSpeech.isLanguageAvailable(TextToSpeech.java:1081)
Run Code Online (Sandbox Code Playgroud)

GR *_*voy 4

我发现当我尝试执行诸如TextToSpeech.getDefaultVoice, or TextToSpeech.getVoices(), or 之类的操作时也会遇到此异常TextToSpeech.getVoice()。我通过不调用它们来解决这个问题,而是通过默认的区域设置来获取我试图通过 Voices 对象获取的内容。

因此,就我而言,我想知道区域设置,以便我可以选择一种语言,所以我执行了以下操作

            Locale lTest = Locale.getDefault();
            res = mTTS.isLanguageAvailable(lTest);
Run Code Online (Sandbox Code Playgroud)