capacitor-community/text-to-speech

bug: has leaked ServiceConnection

robingenz opened this issue · 0 comments

Describe the bug
Got this error message when closing the app:

2021-03-17 16:46:12.644 3856-3856/app E/ActivityThread: Activity app.MainActivity has leaked ServiceConnection android.speech.tts.TextToSpeech$Connection@87036b7 that was originally bound here
    android.app.ServiceConnectionLeaked: Activity app.MainActivity has leaked ServiceConnection android.speech.tts.TextToSpeech$Connection@87036b7 that was originally bound here
        at android.app.LoadedApk$ServiceDispatcher.<init>(LoadedApk.java:1820)
        at android.app.LoadedApk.getServiceDispatcherCommon(LoadedApk.java:1692)
        at android.app.LoadedApk.getServiceDispatcher(LoadedApk.java:1671)
        at android.app.ContextImpl.bindServiceCommon(ContextImpl.java:1755)
        at android.app.ContextImpl.bindService(ContextImpl.java:1684)
        at android.content.ContextWrapper.bindService(ContextWrapper.java:705)
        at android.speech.tts.TextToSpeech.connectToEngine(TextToSpeech.java:821)
        at android.speech.tts.TextToSpeech.initTts(TextToSpeech.java:791)
        at android.speech.tts.TextToSpeech.<init>(TextToSpeech.java:744)
        at android.speech.tts.TextToSpeech.<init>(TextToSpeech.java:723)
        at android.speech.tts.TextToSpeech.<init>(TextToSpeech.java:707)
        at com.getcapacitor.community.tts.TextToSpeech.load(TextToSpeech.java:74)
        at com.getcapacitor.PluginHandle.load(PluginHandle.java:72)
        at com.getcapacitor.PluginHandle.<init>(PluginHandle.java:44)
        at com.getcapacitor.Bridge.registerPlugin(Bridge.java:460)
        at com.getcapacitor.Bridge.registerAllPlugins(Bridge.java:424)
        at com.getcapacitor.Bridge.<init>(Bridge.java:170)
        at com.getcapacitor.BridgeActivity.load(BridgeActivity.java:83)
        at com.getcapacitor.BridgeActivity.init(BridgeActivity.java:62)
        at com.getcapacitor.BridgeActivity.init(BridgeActivity.java:48)
        at app.MainActivity.onCreate(MainActivity.java:17)
        at android.app.Activity.performCreate(Activity.java:7820)
        at android.app.Activity.performCreate(Activity.java:7809)
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1318)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3363)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3527)
        at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83)
        at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2123)
        at android.os.Handler.dispatchMessage(Handler.java:107)
        at android.os.Looper.loop(Looper.java:214)
        at android.app.ActivityThread.main(ActivityThread.java:7710)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:516)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:950)

To Reproduce
Install this plugin and run/close your app.

Expected behavior
No error message.