I am testing my application for accessibility. If user switch off accessibility in mid between then application crashes with the reason Service not registered: android.speech.tts.TextToSpeech. I have called setJavaScriptEnabled(false) in onDetachedFromWindow method but there was no use. Still error is coming.
I haven't use application context in webview because webview is getting initialized using xml.
java.lang.IllegalArgumentException: Service not registered: android.speech.tts.TextToSpeech$Connection@49df6be0
at android.app.LoadedApk.forgetServiceDispatcher(LoadedApk.java:940)
at android.app.ContextImpl.unbindService(ContextImpl.java:1983)
at android.content.ContextWrapper.unbindService(ContextWrapper.java:541)
at android.speech.tts.TextToSpeech$Connection.disconnect(TextToSpeech.java:1575)
at android.speech.tts.TextToSpeech$1.run(TextToSpeech.java:732)
at android.speech.tts.TextToSpeech$1.run(TextToSpeech.java:727)
at android.speech.tts.TextToSpeech$Connection.runAction(TextToSpeech.java:1595)
at android.speech.tts.TextToSpeech.runAction(TextToSpeech.java:629)
at android.speech.tts.TextToSpeech.runActionNoReconnect(TextToSpeech.java:615)
at android.speech.tts.TextToSpeech.shutdown(TextToSpeech.java:727)
at com.android.org.chromium.content.browser.accessibility.AccessibilityInjector$TextToSpeechWrapper.shutdownInternal(AccessibilityInjector.java:462)
at com.android.org.chromium.content.browser.accessibility.AccessibilityInjector.removeAccessibilityApis(AccessibilityInjector.java:296)
at com.android.org.chromium.content.browser.accessibility.JellyBeanAccessibilityInjector.removeAccessibilityApis(JellyBeanAccessibilityInjector.java:97)
at com.android.org.chromium.content.browser.accessibility.AccessibilityInjector.addOrRemoveAccessibilityApisIfNecessary(AccessibilityInjector.java:162)
at com.android.org.chromium.content.browser.ContentViewCore.setInjectedAccessibility(ContentViewCore.java:2884)
at com.android.org.chromium.content.browser.ContentViewCore.setAccessibilityState(ContentViewCore.java:2875)
at com.android.org.chromium.content.browser.ContentViewCore$16.onChange(ContentViewCore.java:2839)
at android.database.ContentObserver$NotificationRunnable.run(ContentObserver.java:180)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:157)
at android.app.ActivityThread.main(ActivityThread.java:5356)
at java.lang.reflect.Method.invokeNative(Method.java)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1265)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1081)
at dalvik.system.NativeStart.main(NativeStart.java)
Finally it has solved. I have to move all webview from the xml file and have added them dynamically and passing application context.
WebView webView = new WebView(getApplicationContext());
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With