gpt4 book ai didi

android - WebView 抛出 “Unknown chromium error: 0”

转载 作者:行者123 更新时间:2023-11-29 20:27:24 25 4
gpt4 key购买 nike

我有一个基于 Cordova 3.5.0 的应用程序,我们现在正在升级到版本 5.2.0。尝试从远程服务器加载 html/javascript 源代码时遇到以下异常:

Unknown chromium error: 0

据我了解,这是由于加载到 webview 中的位置不在 Cordova 白名单中引起的。 This question例如属于此错误消息,但给出的答案是从如何配置 Cordova 的角度出发的。我想知道的是在 java 源代码中实现此功能的位置。所以我特地从Java源码的角度寻找答案,而不是从Cordova的角度寻找答案。 (即说“将此添加到您的 config.xml”不是我要找的答案)。

此错误消息特别无用,了解 Android Webview 的什么配置导致此错误以及如何删除此限制会很有用。

最佳答案

我认为你应该看看这些文件:

这是 SystemWebViewClient 类的 shouldInterceptRequest 方法中的一段代码:

        // Check the against the whitelist and lock out access to the WebView directory
// Changing this will cause problems for your application
if (!parentEngine.pluginManager.shouldAllowRequest(url)) {
LOG.w(TAG, "URL blocked by whitelist: " + url);
// Results in a 404.
return new WebResourceResponse("text/plain", "UTF-8", null);
}

关于android - WebView 抛出 “Unknown chromium error: 0”,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32364635/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com