My activity onInit()contains a call TextToSpeech.setEngineByPackageName():
tts = new TextToSpeech(this, this);
tts.setEngineByPackageName("com.ivona.tts.voicebeta.eng.usa.kendra");
It works on an Android 2.2.2 device, but on an Android 2.3.4 device, it threw a NullPointerException with the following stack trace:
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)
Since I provide a string string parameter, I know that this parameter does not cause a NullPointerException.
I also know that setEngineByPackageName () is deprecated, but this is only with API 14, so this cannot be the reason.
Any idea what could throw this NullPointerException?
EDIT : I would not be interested in “why” if this did not result in an endless bombardment:
I/TextToSpeech.java(3652): initTts() successfully bound to service
onInit() (, ).
, , , onInit() .