Note that there are some explanatory texts on larger screens.

plurals
  1. POTextToSpeech.setEngineByPackageName() triggers NullPointerException
    primarykey
    data
    text
    <p>My activity's <code>onInit()</code> contains a call to <code>TextToSpeech.setEngineByPackageName()</code>:</p> <pre><code> tts = new TextToSpeech(this, this); tts.setEngineByPackageName("com.ivona.tts.voicebeta.eng.usa.kendra"); </code></pre> <p>It works on an Android 2.2.2 device, but on an Android 2.3.4 device it produced a NullPointerException, with the following stack trace:</p> <pre><code> E/TextToSpeech.java - setEngineByPackageName(3423): NullPointerException W/System.err(3423): java.lang.NullPointerException W/System.err(3423): at android.os.Parcel.readException(Parcel.java:1328) W/System.err(3423): at android.os.Parcel.readException(Parcel.java:1276) W/System.err(3423): at android.speech.tts.ITts$Stub$Proxy.setEngineByPackageName(ITts.java:654) W/System.err(3423): at android.speech.tts.TextToSpeech.setEngineByPackageName(TextToSpeech.java:1356) </code></pre> <p>Since I am providing a hard-coded string parameter, I know that the parameter isn't what's causing the NullPointerException.</p> <p>I also know that <a href="http://hi-android.info/src/android/speech/tts/TextToSpeech.java.html" rel="nofollow">setEngineByPackageName()</a> is deprecated but that's only since API 14, so this couldn't be the reason.</p> <p>Any idea what could be causing this NullPointerException?</p> <p><strong>EDIT</strong>: I wouldn't have been concerned with the "why" if this didn't result in an endless bombardment of:</p> <pre><code>I/TextToSpeech.java(3652): initTts() successfully bound to service </code></pre> <p>Followed by calls to <code>onInit()</code> (by the system, not by my code).</p> <p>My hope is that if I underderstand why this is happening, I can stop the bombardment of <code>onInit()</code>s and recover gracefully from the error.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload