本文介绍了IllegalArgumentException:无效的int:“OS”与三星tts的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我在Android应用程序中使用文本语音。它与Google TTs和espeak一起工作,但是当我与三星TTS一起使用时, pre> java.lang.IllegalArgumentException:无效的int:OS
在android.os.Parcel.readException(Parcel.java:1429)
在android.os .Parcel.readException(Parcel.java:1379)
at android.speech.tts.ITextToSpeechService $ Stub $ Proxy.isLanguageAvailable(ITextToSpeechService.java:482)
at android.speech.tts.TextToSpeech $ 10。运行(TextToSpeech.java:1084)

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

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

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

at android.speech.tts.TextToSpeech.isLanguageAvailable(TextToSpeech.java:1081)


解决方案

我发现当我尝试像 TextToSpeech.getDefaultVoice TextToSpeech .getVoices() TextToSpeech.getVoice()。我通过不打电话来解决这个问题,而是通过默认的区域设置来完成我通过Voices对象获得的东西。



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

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


I'm using Text to speech in my android application.It is working Fine with Google TTs and espeak, But when i used with Samsung TTS it gives following Exception.

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)
解决方案

I have found that I get this exception also when I try to do something like TextToSpeech.getDefaultVoice, or TextToSpeech.getVoices(), or TextToSpeech.getVoice(). I worked around this by not calling them, and instead working through the default Locale to get what I was trying to get via the Voices object.

So in my case I wanted to know the Locale so I could select a language, so I did the following

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

这篇关于IllegalArgumentException:无效的int:“OS”与三星tts的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-27 04:34