IllegalArgumentException:无效int:与三星tts“操作系统”

我正在使用文字在我的android应用程序中发言。它与谷歌TTs和espeak工作良好,但是当我用三星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) 

Solutions Collecting From Web of "IllegalArgumentException:无效int:与三星tts“操作系统”"

我发现,当我尝试执行类似TextToSpeech.getDefaultVoiceTextToSpeech.getVoices()TextToSpeech.getVoice()操作时,我也会得到这个exception。 我通过不调用它们来解决这个问题,而是通过默认的Locale来获取我想通过Voices对象获取的内容。

所以在我的情况下,我想知道语言环境,所以我可以select一种语言,所以我做了以下

  Locale lTest = Locale.getDefault(); res = mTTS.isLanguageAvailable(lTest);