Android Webview: Cannot call determinedVisibility(

2019-01-09 05:05发布

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!?

11条回答
我命由我不由天
2楼-- · 2019-01-09 05:42

This is how I fixed a similar issue:

    mWebView.setWebChromeClient(new WebChromeClient());
    mWebView.getSettings().setJavaScriptEnabled(true);
    mWebView.getSettings().setDomStorageEnabled(true);

    mWebView.setWebViewClient(new WebViewClient() {
        public boolean shouldOverrideUrlLoading(WebView view,String url) {
            return false;
        }
    });

    mWebView.loadURL(...
查看更多
smile是对你的礼貌
3楼-- · 2019-01-09 05:44

I faced the same issue.

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

查看更多
干净又极端
4楼-- · 2019-01-09 05:46

Just a bit of configuration:

    webview.getSettings().setJavaScriptEnabled(true);
    webview.getSettings().setDomStorageEnabled(true);
查看更多
Anthone
5楼-- · 2019-01-09 05:46

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.

查看更多
家丑人穷心不美
6楼-- · 2019-01-09 05:47

Late to party, but might help some. May sound silly as hell, but the mistake I made was not adding http:// in the beginning of the URL.

查看更多
Juvenile、少年°
7楼-- · 2019-01-09 05:49

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.

查看更多
登录 后发表回答