3
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Android11でTextToSpeechが動作しない時の対処法

Posted at

##はじめに
急に開発で使用しているPixel3でTextToSpeechが動作しなくなった。
他の開発端末Xperia等では普通に動く。
TextToSpeechのonInitListenerで status = -1が返却される

##原因及び対処法
###原因: android 11の仕様

###対処法: AndroidManifest.xmlにINTENT_ACTION_TTS_SERVICEを追加
公式に以下のように書かれていました。

Apps targeting Android 11 that use text-to-speech should declare TextToSpeech.Engine#INTENT_ACTION_TTS_SERVICE in the queries elements of their manifest:

マニフェストに以下のような感じで追加すると動くようになります。

AndroidManifest.xml
<manifest>
  ・・・
    <queries>
   ・・・
        <intent>
            <action android:name="android.intent.action.TTS_SERVICE" />
        </intent>
    </queries>
</manifest>
3
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?