私は本当に奇妙な問題を抱えています。
logcat でこのクラッシュが発生し続けていますが、奇妙なことに、これは私のアプリがそのこととは何の関係もないというText To Speech
ことです。このアクティビティだけでなく、アプリ全体でまったく使用されていません。
08-04 03:47:19.321: E/ActivityThread(24755): Activity com.lablabla.similarsearch.WebViewActivity has leaked ServiceConnection android.speech.tts.TextToSpeech$Connection@443065c0 that was originally bound here
08-04 03:47:19.321: E/ActivityThread(24755): android.app.ServiceConnectionLeaked: Activity com.lablabla.similarsearch.WebViewActivity has leaked ServiceConnection android.speech.tts.TextToSpeech$Connection@443065c0 that was originally bound here
08-04 03:47:19.321: E/ActivityThread(24755): at android.app.LoadedApk$ServiceDispatcher.<init>(LoadedApk.java:974)
08-04 03:47:19.321: E/ActivityThread(24755): at android.app.LoadedApk.getServiceDispatcher(LoadedApk.java:868)
08-04 03:47:19.321: E/ActivityThread(24755): at android.app.ContextImpl.bindServiceAsUser(ContextImpl.java:1452)
08-04 03:47:19.321: E/ActivityThread(24755): at android.app.ContextImpl.bindService(ContextImpl.java:1440)
08-04 03:47:19.321: E/ActivityThread(24755): at android.content.ContextWrapper.bindService(ContextWrapper.java:496)
08-04 03:47:19.321: E/ActivityThread(24755): at android.speech.tts.TextToSpeech.connectToEngine(TextToSpeech.java:685)
08-04 03:47:19.321: E/ActivityThread(24755): at android.speech.tts.TextToSpeech.initTts(TextToSpeech.java:655)
08-04 03:47:19.321: E/ActivityThread(24755): at android.speech.tts.TextToSpeech.<init>(TextToSpeech.java:608)
08-04 03:47:19.321: E/ActivityThread(24755): at android.webkit.AccessibilityInjector$TextToSpeechWrapper.<init>(AccessibilityInjector.java:682)
08-04 03:47:19.321: E/ActivityThread(24755): at android.webkit.AccessibilityInjector.addTtsApis(AccessibilityInjector.java:483)
08-04 03:47:19.321: E/ActivityThread(24755): at android.webkit.AccessibilityInjector.addAccessibilityApisIfNecessary(AccessibilityInjector.java:168)
08-04 03:47:19.321: E/ActivityThread(24755): at android.webkit.AccessibilityInjector.updateJavaScriptEnabled(AccessibilityInjector.java:418)
08-04 03:47:19.321: E/ActivityThread(24755): at android.webkit.WebViewClassic.updateJavaScriptEnabled(WebViewClassic.java:1682)
08-04 03:47:19.321: E/ActivityThread(24755): at android.webkit.WebSettingsClassic.setJavaScriptEnabled(WebSettingsClassic.java:1125)
08-04 03:47:19.321: E/ActivityThread(24755): at com.lablabla.similarsearch.WebViewActivity.onCreate(WebViewActivity.java:24)
08-04 03:47:19.321: E/ActivityThread(24755): at android.app.Activity.performCreate(Activity.java:5133)
08-04 03:47:19.321: E/ActivityThread(24755): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
08-04 03:47:19.321: E/ActivityThread(24755): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2175)
08-04 03:47:19.321: E/ActivityThread(24755): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261)
08-04 03:47:19.321: E/ActivityThread(24755): at android.app.ActivityThread.access$600(ActivityThread.java:141)
08-04 03:47:19.321: E/ActivityThread(24755): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
08-04 03:47:19.321: E/ActivityThread(24755): at android.os.Handler.dispatchMessage(Handler.java:99)
08-04 03:47:19.321: E/ActivityThread(24755): at android.os.Looper.loop(Looper.java:137)
08-04 03:47:19.321: E/ActivityThread(24755): at android.app.ActivityThread.main(ActivityThread.java:5103)
08-04 03:47:19.321: E/ActivityThread(24755): at java.lang.reflect.Method.invokeNative(Native Method)
08-04 03:47:19.321: E/ActivityThread(24755): at java.lang.reflect.Method.invoke(Method.java:525)
08-04 03:47:19.321: E/ActivityThread(24755): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
08-04 03:47:19.321: E/ActivityThread(24755): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
08-04 03:47:19.321: E/ActivityThread(24755): at dalvik.system.NativeStart.main(Native Method)
Intent
そのアクティビティのコードは次のとおりですWebView
。
public class WebViewActivity extends Activity {
public static final String EXTRA_URL = "extra_url";
private WebView webView;
private String baseUrl;
@SuppressLint("SetJavaScriptEnabled")
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.webview);
webView = (WebView) findViewById(R.id.webView);
webView.getSettings().setJavaScriptEnabled(true);
webView.setWebViewClient(new WebViewClient());
webView.getSettings().setUserAgentString(
"Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/20 Safari/537.31");
baseUrl = getIntent().getStringExtra(EXTRA_URL);
webView.loadUrl(baseUrl);
}
}