mapbox-navigation-android
mapbox-navigation-android copied to clipboard
TextToSpeech error on NavigationView
I basically copied everything from the EmbeddedNavigationActivity from the navigation sdk sample and I am getting this error. I have also tried using navigationlauncher, it does not show any error but i get stuck in a blank screen.
07-20 01:23:14.548 19247-19247/com.example.floyd.frank E/TextToSpeech: Failed to bind to com.google.android.tts
07-20 01:23:14.552 19247-19247/com.example.floyd.frank E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.floyd.frank, PID: 19247
java.lang.NullPointerException: Attempt to invoke virtual method 'int android.speech.tts.TextToSpeech.setOnUtteranceProgressListener(android.speech.tts.UtteranceProgressListener)' on a null object reference
at com.mapbox.services.android.navigation.ui.v5.voice.AndroidSpeechPlayer.setSpeechListener(AndroidSpeechPlayer.java:145)
at com.mapbox.services.android.navigation.ui.v5.voice.AndroidSpeechPlayer.access$000(AndroidSpeechPlayer.java:20)
at com.mapbox.services.android.navigation.ui.v5.voice.AndroidSpeechPlayer$1.onInit(AndroidSpeechPlayer.java:41)
at android.speech.tts.TextToSpeech.dispatchOnInit(TextToSpeech.java:824)
at android.speech.tts.TextToSpeech.initTts(TextToSpeech.java:802)
at android.speech.tts.TextToSpeech.<init>(TextToSpeech.java:733)
at android.speech.tts.TextToSpeech.<init>(TextToSpeech.java:712)
at android.speech.tts.TextToSpeech.<init>(TextToSpeech.java:696)
at com.mapbox.services.android.navigation.ui.v5.voice.AndroidSpeechPlayer.<init>(AndroidSpeechPlayer.java:38)
at com.mapbox.services.android.navigation.ui.v5.voice.SpeechPlayerProvider.initAndroidSpeechPlayer(SpeechPlayerProvider.java:97)
at com.mapbox.services.android.navigation.ui.v5.voice.SpeechPlayerProvider.initialize(SpeechPlayerProvider.java:78)
at com.mapbox.services.android.navigation.ui.v5.voice.SpeechPlayerProvider.<init>(SpeechPlayerProvider.java:43)
at com.mapbox.services.android.navigation.ui.v5.NavigationViewModel.initializeSpeechPlayerProvider(NavigationViewModel.java:234)
at com.mapbox.services.android.navigation.ui.v5.NavigationViewModel.initVoiceInstructions(NavigationViewModel.java:228)
at com.mapbox.services.android.navigation.ui.v5.NavigationViewModel.initializeNavigation(NavigationViewModel.java:173)
at com.mapbox.services.android.navigation.ui.v5.NavigationView.initializeNavigation(NavigationView.java:503)
at com.mapbox.services.android.navigation.ui.v5.NavigationView.startNavigation(NavigationView.java:358)
at com.example.floyd.frank.MainNavigationActivity.startNavigation(MainNavigationActivity.java:192)
at com.example.floyd.frank.MainNavigationActivity.access$000(MainNavigationActivity.java:42)
at com.example.floyd.frank.MainNavigationActivity$1.onResponse(MainNavigationActivity.java:206)
at com.mapbox.api.directions.v5.MapboxDirections$1.onResponse(MapboxDirections.java:169)
at retrofit2.ExecutorCallAdapterFactory$ExecutorCallbackCall$1$1.run(ExecutorCallAdapterFactory.java:70)
at android.os.Handler.handleCallback(Handler.java:836)
at android.os.Handler.dispatchMessage(Handler.java:103)
at android.os.Looper.loop(Looper.java:203)
at android.app.ActivityThread.main(ActivityThread.java:6331)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1085)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:946)
Android API: 24 Mapbox Navigation SDK version: 0.16.0-SNAPSHOT
Steps to trigger behavior
- Opening mapbox navigationview 2. 3.
Expected behavior
Show navigation view
Actual behavior
Crashes
Hi @floydignified, I've created a PR to address your first issue and prevent the NPE. As to your second issue, blank maps are almost always an issue with your access token.
@floydignified though in the meantime, you can try putting a breakpoint here to at least determine what status code is being returned.