Android:TextToSpeech无效的int:“ OS”异常

时间:2018-08-17 06:46:44

标签: android google-text-to-speech

我使用以下代码将语言设置为文本到语音,但出现以下异常。

override fun onInit(status: Int) {
            if (textToSpeech == null || status == TextToSpeech.ERROR) {
                isTextToSpeechInitialized = false
                return
            }

            isTextToSpeechInitialized = true
            if (textToSpeech!!.isLanguageAvailable(CountryConfiguration.locale) == TextToSpeech.LANG_COUNTRY_AVAILABLE) {
                textToSpeech!!.language = CountryConfiguration.locale
            }
            readNextFile()
        }

例外情况如下:

  Fatal Exception: java.lang.IllegalArgumentException: Invalid int: "OS"
       at android.os.Parcel.readException(Parcel.java:1625)

     android.speech.tts.TextToSpeech.setLanguage(TextToSpeech.java:1535)

0 个答案:

没有答案