活动泄露了IntentReceiver – LollipopBrowserAccessibilityManager

我希望能在这里find一些帮助,因为我不熟悉Android中的BroadcastReceivers。 这段代码打开WebView将您redirect到login页面,并在检测到URL更改后接收login令牌。 之后,活动closures。

@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_login); mLoginWebView = (WebView) findViewById(R.id.webview_login); redirectUrl = getString(R.string.app_redirect_url); //RECEIVE PLATFORM ID Bundle bundle = getIntent().getExtras(); if(bundle != null){ platform = bundle.getInt(ConstantsHelper.LOGIN_EXTRA_TOKEN); } mLoginWebView.setWebViewClient(new WebViewClient() { @Override public boolean shouldOverrideUrlLoading(WebView view, String url) { Log.d(TAG, "URL change to to " + url + " was detected"); if (url.contains(redirectUrl) || url.contains("passport.twitch.tv")) { Log.d(TAG, "Login with platform " + platform); switch (platform){ //GET INSTAGRAM AUTH TOKEN case ConstantsHelper.ID_INSTAGRAM:{ String accessToken = url.split("=")[1]; SharedPreferenceHelper.putString(ConstantsHelper.PREF_INST_ACCESS_TOKEN, accessToken); NetworkManager.getInstance().catchTokens(); } //GET TWITCH AUTH TOKEN case ConstantsHelper.ID_TWITCH:{ String accessToken = url.substring(url.indexOf("=") + 1, url.indexOf("&")); SharedPreferenceHelper.putString(ConstantsHelper.PREF_TWITCH_ACCESS_TOKEN, accessToken); NetworkManager.getInstance().catchTokens(); } } finish(); //Activity is closed return true; } return false; } }); switch (platform){ case 1: mLoginWebView.loadUrl(NetworkManager.getInstance().getInstagramAuthUrl(getApplicationContext())); case 4: mLoginWebView.loadUrl(NetworkManager.getInstance().getTwitchAuthUrl(getApplicationContext())); } } 

没有任何反应,LogCat显示这个错误:

 Activity com.maximutan.socialmedia_feed_merger.activities.LoginActivity has leaked IntentReceiver org.chromium.content.browser.accessibility.LollipopBrowserAccessibilityManager$1@25014a that was originally registered here. Are you missing a call to unregisterReceiver()? android.app.IntentReceiverLeaked: Activity com.maximutan.socialmedia_feed_merger.activities.LoginActivity has leaked IntentReceiver org.chromium.content.browser.accessibility.LollipopBrowserAccessibilityManager$1@25014a that was originally registered here. Are you missing a call to unregisterReceiver()? at android.app.LoadedApk$ReceiverDispatcher.<init>(LoadedApk.java:962) at android.app.LoadedApk.getReceiverDispatcher(LoadedApk.java:763) at android.app.ContextImpl.registerReceiverInternal(ContextImpl.java:1179) at android.app.ContextImpl.registerReceiver(ContextImpl.java:1159) at android.app.ContextImpl.registerReceiver(ContextImpl.java:1153) at android.content.ContextWrapper.registerReceiver(ContextWrapper.java:554) at android.content.ContextWrapper.registerReceiver(ContextWrapper.java:554) at org.chromium.content.browser.accessibility.LollipopBrowserAccessibilityManager.<init>(LollipopBrowserAccessibilityManager.java:3) at org.chromium.content.browser.accessibility.BrowserAccessibilityManager.create(BrowserAccessibilityManager.java:2) at org.chromium.base.SystemMessageHandler.nativeDoRunLoopOnce(Native Method) at org.chromium.base.SystemMessageHandler.handleMessage( SystemMessageHandler.java:7) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:148) at android.app.ActivityThread.main(ActivityThread.java:5527) ,at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run( ZygoteInit.java:730) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:620) 

我的问题是,我不知道哪个BroadcastReceiver我必须取消注册,因为我没有创build和初始化一个。

谢谢你的帮助

Solutions Collecting From Web of "活动泄露了IntentReceiver – LollipopBrowserAccessibilityManager"

您是否使用以下任何WebSettings

  settings.setAllowContentAccess(true); settings.setAllowFileAccessFromFileURLs(true); settings.setAllowUniversalAccessFromFileURLs(true); settings.setAllowFileAccess(true); 

我发现通过禁用这些选项(我实际上并不需要它们),错误消失了。 我猜测它与其中之一所需的兼容性库有关。