Android AdvancedWebView causes ANR when inflating view

799 views Asked by At

I have a very strange ANR problem. During about 33% of application startups, app hangs on initializing AdvancedWebView. It occurs only on Android 6.X and 7.X.

"main" prio=5 tid=1 Waiting
  | group="main" sCount=1 dsCount=0 obj=0x756e2a88 self=0x7253895a00
  | sysTid=5256 nice=-10 cgrp=default sched=0/0 handle=0x72577baa98
  | state=S schedstat=( 362198032 46014107 637 ) utm=24 stm=11 core=3 HZ=100
  | stack=0x7fc2f0d000-0x7fc2f0f000 stackSize=8MB
  | held mutexes=
  at java.lang.Object.wait!(Native method)
  - waiting on <0x0a4a9cf4> (a java.lang.Object)
  at java.lang.Thread.parkFor$(Thread.java:2127)
  - locked <0x0a4a9cf4> (a java.lang.Object)
  at sun.misc.Unsafe.park(Unsafe.java:325)
  at java.util.concurrent.locks.LockSupport.park(LockSupport.java:161)
  at java.util.concurrent.FutureTask.awaitDone(FutureTask.java:421)
  at java.util.concurrent.FutureTask.get(FutureTask.java:163)
  at android.os.AsyncTask.get(AsyncTask.java:514)
  at org.chromium.content.browser.BrowserStartupController.prepareToStartBrowserProcess(BrowserStartupController.java:57)
  at org.chromium.content.browser.BrowserStartupController.startBrowserProcessesSync(BrowserStartupController.java:16)
  at org.chromium.android_webview.AwBrowserProcess$1.run(AwBrowserProcess.java:14)
  at org.chromium.base.ThreadUtils.runOnUiThreadBlocking(ThreadUtils.java:10)
  at com.android.webview.chromium.WebViewChromiumFactoryProvider.startChromiumLocked(WebViewChromiumFactoryProvider.java:219)
  at com.android.webview.chromium.WebViewChromiumFactoryProvider.ensureChromiumStartedLocked(WebViewChromiumFactoryProvider.java:151)
  at com.android.webview.chromium.WebViewChromiumFactoryProvider.startYourEngines(WebViewChromiumFactoryProvider.java:239)
  - locked <0x064f5c1d> (a java.lang.Object)
  at com.android.webview.chromium.WebViewChromium.init(WebViewChromium.java:30)
  at android.webkit.WebView.<init>(WebView.java:636)
  at android.webkit.WebView.<init>(WebView.java:572)
  at android.webkit.WebView.<init>(WebView.java:555)
  at android.webkit.WebView.<init>(WebView.java:542)
  at im.delight.android.webview.AdvancedWebView.<init>(AdvancedWebView.java:102)
  at java.lang.reflect.Constructor.newInstance0!(Native method)
  at java.lang.reflect.Constructor.newInstance(Constructor.java:430)
  at android.view.LayoutInflater.createView(LayoutInflater.java:645)
  at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:787)
  at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:727)
  at android.view.LayoutInflater.rInflate(LayoutInflater.java:858)
  at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821)
  at android.view.LayoutInflater.inflate(LayoutInflater.java:518)
  - locked <0x09493e92> (a java.lang.Object[])
  at android.view.LayoutInflater.inflate(LayoutInflater.java:426)
  at android.databinding.DataBindingUtil.inflate(DataBindingUtil.java:116)
  at android.databinding.DataBindingUtil.inflate(DataBindingUtil.java:88)
  at com.xxx.xxx.xxx.xxx.view.fragment.WebViewFragment.onCreateView(WebViewFragment.java:99)
  at android.support.v4.app.Fragment.performCreateView(Fragment.java:2189)
  at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1299)
  at android.support.v4.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManager.java:1528)
  at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1595)
  at android.support.v4.app.BackStackRecord.executeOps(BackStackRecord.java:757)
  at android.support.v4.app.FragmentManagerImpl.executeOps(FragmentManager.java:2355)
  at android.support.v4.app.FragmentManagerImpl.executeOpsTogether(FragmentManager.java:2146)
  at android.support.v4.app.FragmentManagerImpl.optimizeAndExecuteOps(FragmentManager.java:2098)
  at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:2008)
  at android.support.v4.app.FragmentController.execPendingActions(FragmentController.java:388)
  at android.support.v4.app.FragmentActivity.onStart(FragmentActivity.java:607)
  at android.support.v7.app.AppCompatActivity.onStart(AppCompatActivity.java:178)
  at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1248)
  at android.app.Activity.performStart(Activity.java:6699)
  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2629)
  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2727)
  at android.app.ActivityThread.-wrap12(ActivityThread.java:-1)
  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1478)
  at android.os.Handler.dispatchMessage(Handler.java:102)
  at android.os.Looper.loop(Looper.java:154)
  at android.app.ActivityThread.main(ActivityThread.java:6121)
  at java.lang.reflect.Method.invoke!(Native method)
  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:889)
  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:779)

I do not have any additional AsyncTasks. The view is inflated with code:

DataBindingUtil.inflate(inflater, R.layout.fragment_web_view, container, false);

Do you have any ideas how to find the reason of this ANR?

0

There are 0 answers