I'm using StrictMode policy while developing my app:
StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder()
.detectLeakedSqlLiteObjects()
.detectLeakedClosableObjects()
.penaltyLog()
.penaltyDeath()
.build());
I'm experiencing a new type of crash, which appeared from seems nowhere:
W/WebView: java.lang.Throwable: A WebView method was called on thread 'FinalizerDaemon'. All WebView methods must be called on the same thread. (Expected Looper Looper (main, tid 2) {7424b6e} called on null, FYI main Looper is Looper (main, tid 2) {7424b6e})
at android.webkit.WebView.checkThread(WebView.java:2695)
at android.webkit.WebView.loadUrl(WebView.java:969)
at com.google.android.gms.ads.internal.webview.v.e(:com.google.android.gms.policy_ads_fdr_dynamite@20290004@20290004.249178941.249178941:1)
at com.google.android.gms.ads.internal.webview.v.destroy(:com.google.android.gms.policy_ads_fdr_dynamite@20290004@20290004.249178941.249178941:9)
at com.google.android.gms.ads.internal.webview.t.destroy(:com.google.android.gms.policy_ads_fdr_dynamite@20290004@20290004.249178941.249178941:10)
at com.google.android.gms.ads.nonagon.ad.interstitial.b.finalize(:com.google.android.gms.policy_ads_fdr_dynamite@20290004@20290004.249178941.249178941:2)
at java.lang.Daemons$FinalizerDaemon.doFinalize(Daemons.java:252)
at java.lang.Daemons$FinalizerDaemon.runInternal(Daemons.java:239)
at java.lang.Daemons$Daemon.run(Daemons.java:105)
at java.lang.Thread.run(Thread.java:764)
2019-06-17 15:25:59.035 31170-31180/hu.myapp.name D/StrictMode: StrictMode policy violation: android.os.strictmode.WebViewMethodCalledOnWrongThreadViolation
at android.webkit.WebView.checkThread(WebView.java:2695)
at android.webkit.WebView.loadUrl(WebView.java:969)
at com.google.android.gms.ads.internal.webview.v.e(:com.google.android.gms.policy_ads_fdr_dynamite@20290004@20290004.249178941.249178941:1)
at com.google.android.gms.ads.internal.webview.v.destroy(:com.google.android.gms.policy_ads_fdr_dynamite@20290004@20290004.249178941.249178941:9)
at com.google.android.gms.ads.internal.webview.t.destroy(:com.google.android.gms.policy_ads_fdr_dynamite@20290004@20290004.249178941.249178941:10)
at com.google.android.gms.ads.nonagon.ad.interstitial.b.finalize(:com.google.android.gms.policy_ads_fdr_dynamite@20290004@20290004.249178941.249178941:2)
at java.lang.Daemons$FinalizerDaemon.doFinalize(Daemons.java:252)
at java.lang.Daemons$FinalizerDaemon.runInternal(Daemons.java:239)
at java.lang.Daemons$Daemon.run(Daemons.java:105)
at java.lang.Thread.run(Thread.java:764)
My app DOES NOT HAVE ANY web views, that is why this is strange.
This is really annoying, the crash doesn't include any lines of my code, only android and google packages.
Any ideas?
Apparently you're using an in-app ads SDK that uses a WebView (Admob?) See com.google.android.gms.ads.internal.webview...
.
Plus, from my experience with WebView
and StrictMode
, the fact you're getting this behavior probably it is not a bug of the Ads SDK: I our app we had to disable some checks (or reduce the penalty to log) in order to work around the problem (we do use WebView
, and the WebView
itself creates issues with StrictMode
because of disk access done from UI thread and similar issues).