Android:网络视图:获取错误代码 -6 net::ERR_CONNECTION_REFUSED

Android : webview : getting error code -6 net::ERR_CONNECTION_REFUSED

我在

的 android webview 上不断收到错误代码 -6 和描述 net::ERR_CONNECTION_REFUSED
public class MainActivity extends Activity {

@Override
protected void onCreate(Bundle savedInstanceState) {
    this.requestWindowFeature(Window.FEATURE_NO_TITLE);
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    final WebView webview =(WebView) this.findViewById(R.id.webView);

    WebSettings webSettings = webview.getSettings();
    webSettings.setJavaScriptEnabled(true);
    webview.setWebViewClient(new MyWebViewClient());//I only implemented onReceivedError to display the errors in logcat

    webview.loadUrl("http://mydomainexample.com");// it loads http://google.com but throws error code = -6 for my doamin which works fine in any navigator

}

虽然完全相同的 url(示例 http://aaaaaaaaa.com)在任何导航器中都能很好地工作,但 webview 建立连接的方式是否与导航器不同? 是什么导致了这个问题?

可能是由于网站的 cookie 请求(参见 Android Webview error code -6) but please post your code. There is also a posting on https://github.com/ionic-team/capacitor/issues/1848

问题是加载的网页有一个 js 文件,该文件异步地向服务器上被阻止的端口发出请求。我已尝试删除该请求并且成功了