Android Webview给出net :: ERR_CACHE_MISS消息 [英] Android Webview gives net::ERR_CACHE_MISS message

查看:672
本文介绍了Android Webview给出net :: ERR_CACHE_MISS消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我构建了一个Web应用程序,并希望创建一个具有显示我的Web应用程序的Web视图的android应用程序.按照Google Developer的说明创建应用后,我已将其成功安装在装有Android 5.1.1.的手机上.

I built a web app and wants to create an android app that has a webview that shows my web app. After following the instructions from Google Developer to create an app, I successfully installed it on my phone with Android 5.1.1.

但是,当我第一次运行该应用程序时,网络视图会显示以下消息:

However, when I run the app for the first time, the webview shows the message:

网页不可用

无法将[Lorem Ipsum URL]上的网页加载为:

The Web page at [Lorem Ipsum URL] could not be loaded as:

net :: ERR_CACHE_MISS

net::ERR_CACHE_MISS

推荐答案

答案汇总!我只想将所有答案组合成一个全面的答案.

Answers assembled! I wanted to just combine all the answers into one comprehensive one.

1..检查manifest.xml中是否存在<uses-permission android:name="android.permission.INTERNET" />. 确保它嵌套在<manifest>而不是<application> 下.感谢 sajid45 莉亚尼斯·贝拉克斯奎兹(Liyanis Velazquez)

1. Check if <uses-permission android:name="android.permission.INTERNET" /> is present in manifest.xml. Make sure that it is nested under <manifest> and not <application>. Thanks to sajid45 and Liyanis Velazquez

2..请确保您使用的是<uses-permission android:name="android.permission.INTERNET"/>而不是已弃用的<uses-permission android:name="android.permission.internet"/>.非常感谢 alan_shi creos .

2. Ensure that you are using <uses-permission android:name="android.permission.INTERNET"/> instead of the deprecated <uses-permission android:name="android.permission.internet"/>. Much thanks to alan_shi and creos.

3..如果最低版本低于KK,请检查您是否拥有

3. If minimum version is below KK, check that you have

if (18 < Build.VERSION.SDK_INT ){
    //18 = JellyBean MR2, KITKAT=19
    mWeb.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE);
}

if (Build.VERSION.SDK_INT >= 19) {
        mWebView.getSettings().setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK);
}

因为仅在KK(SDK 19)中添加了正确的Web视图.感谢 Devavrata Liyanis Velazquez

because proper webview is only added in KK (SDK 19). Thanks to Devavrata, Mike ChanSeong Kim and Liyanis Velazquez

4..确保您没有webView.getSettings().setBlockNetworkLoads (false);.感谢 TechNikh 指出这一点.

4. Ensure that you don't have webView.getSettings().setBlockNetworkLoads (false);. Thanks to TechNikh for pointing this out.

5..如果其他所有方法均失败,请确保更新了Android Studio,Android SDK和仿真器映像(如果使用的是映像).而且,如果您仍然遇到问题,只需打开一个新问题,然后在下面的URL中添加评论即可.

5. If all else fails, make sure that your Android Studio, Android SDK and the emulator image (if you are using one) is updated. And if you are still meeting the problem, just open a new question and make a comment below to your URL.

这篇关于Android Webview给出net :: ERR_CACHE_MISS消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆