Android Webview: Cannot call determinedVisibility() - never saw a connection for the pid

44,353

Solution 1

Just a bit of configuration:

    webview.getSettings().setJavaScriptEnabled(true);
    webview.getSettings().setDomStorageEnabled(true);

Solution 2

I got the same error and Burhans solution was not helping me. I think things went wrong when you´re trying to load different urls too fast.

Edit: Found a better solution credits go to user2652394 WebView must be loaded twice to load correctly

You have to do something like this:

        webView.postDelayed(new Runnable() {

            @Override
            public void run() {
                webView.loadUrl(landingpage);
            }
        }, 500);

Solution 3

I faced the same issue.

Was solved by giving a WebView a static height (ie 300dp) or specifying minHeight value.

Solution 4

Background

Here is the source code of the method in the browser engine that gives the error (BindingManagerImpl.java), from Chromium source:

@Override
public void determinedVisibility(int pid) {
    ManagedConnection managedConnection;
    synchronized (mManagedConnections) {
        managedConnection = mManagedConnections.get(pid);
    }
    if (managedConnection == null) {
        Log.w(TAG, "Cannot call determinedVisibility() - never saw a connection for the pid: "
                + "%d", pid);
        return;
    }

Analysis

It's a rendering warning from content.

Consecutive calls to loadUrl cause a race condition. The problem is that loadUrl("file://..") doesn't complete immediately, and so when you call loadUrl("javascript:..") it will sometimes execute before the page has loaded.

Detail

For more detail see this stackoverflow answer.

Solution 5

This problem in my case produce by incorrect settings in layout properties. I had used:

    <WebView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:id="@+id/webView"
    android:layout_below="@+id/textView"
    android:layout_alignParentLeft="true"
    android:layout_alignParentStart="true"
    android:layout_alignParentBottom="true"
    android:layout_alignParentRight="true"
    android:layout_alignParentTop="false"
    android:layout_alignWithParentIfMissing="false" />

Instead of setting:

    <WebView
    android:id="@+id/webView"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:layout_below="@+id/textView" />

The problems had been solved, when I removed "layout_alignParent" settings.

Share:
44,353
Laurens V
Author by

Laurens V

Updated on October 25, 2020

Comments

  • Laurens V
    Laurens V over 3 years

    I have a Android Webview and when I click on a link to download a file (image of pdf etc) I got a error message.

    Error message:
    Cannot call determinedVisibility() - never saw a connection for the pid
    

    Any idea what I do wrong? Who can help please!?

  • marceloquinta
    marceloquinta almost 8 years
    I got the same problem and this lines did not solve my problem.
  • Humberto Castañeda
    Humberto Castañeda almost 8 years
    How did you solve your problem @marceloquinta? Mine isn't working with this either.
  • Bharatesh
    Bharatesh over 7 years
    fixed, but by calling inside shouldOverrideUrlLoading method.
  • Sathish Kumar J
    Sathish Kumar J about 7 years
    this is also gives same warning for me? any other solutions??
  • Kiki
    Kiki almost 7 years
    Great! All the other solutions did not work for me. This one worked :)
  • ishmaelMakitla
    ishmaelMakitla over 6 years
    A helpful answer should always explain why the problem (error) is occurring as well as explaining why the suggested answer (your code) should work or fix it. Without any explanation this answer is not helpful - this is very important especially for a question that already has a number of answers submitted.