Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SnipsPlatformClient crashes on android without TTS package installed #5

Open
lhucinequr opened this issue Mar 28, 2018 · 1 comment

Comments

@lhucinequr
Copy link

Here is the relevant stacktrace
11:32:02.832 10831-10831/? E/AndroidRuntime: FATAL EXCEPTION: main
Process: pro.i_surveillance.comfort_life_poc, PID: 10831
java.lang.RuntimeException: Unable to start activity ComponentInfo{pro.i_surveillance.comfort_life_poc/pro.i_surveillance.comfort_life_poc.MainActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'int android.speech.tts.TextToSpeech.setOnUtteranceProgressListener(android.speech.tts.UtteranceProgressListener)' on a null object reference
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2946)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3046)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1688)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6809)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'int android.speech.tts.TextToSpeech.setOnUtteranceProgressListener(android.speech.tts.UtteranceProgressListener)' on a null object reference
at ai.snips.platform.TtsHandler.registerTtsUtteranceProgressListener(TtsHandler.kt:21)
at ai.snips.platform.TtsHandler.access$registerTtsUtteranceProgressListener(TtsHandler.kt:11)
at ai.snips.platform.TtsHandler$tts$1.onInit(TtsHandler.kt:14)
at android.speech.tts.TextToSpeech.dispatchOnInit(TextToSpeech.java:824)
at android.speech.tts.TextToSpeech.initTts(TextToSpeech.java:802)
at android.speech.tts.TextToSpeech.(TextToSpeech.java:733)
at android.speech.tts.TextToSpeech.(TextToSpeech.java:712)
at android.speech.tts.TextToSpeech.(TextToSpeech.java:696)
at ai.snips.platform.TtsHandler.(TtsHandler.kt:13)
at ai.snips.platform.SnipsPlatformClient.connect(SnipsPlatformClient.kt:173)

@thanksmister
Copy link

thanksmister commented Oct 26, 2018

I would suggest testing that the user has TTS installed on the device before trying to initiate Snips as it's a requirement for the Android Snips SDK. The demo doesn't check, so it will crash, but if you were building your own application, then you could add the logic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants