java 如何解决webview错误
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/29450746/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to solve webview error
提问by Amir.KH
I have some error in logcat that I don't know how to fix it.I need some help to find solution.
我在 logcat 中有一些错误,我不知道如何修复它。我需要一些帮助才能找到解决方案。
04-04 15:49:37.143 2088-2107/com.exercise.AndroidHTML W/chromium﹕ [WARNING:proxy_service.cc(888)] PAC support disabled because there is no system implementation
04-04 15:49:37.153 2088-2088/com.exercise.AndroidHTML D/﹕ HostConnection::get() New Host Connection established 0xb8eab450, tid 2088
04-04 15:49:37.293 2088-2088/com.exercise.AndroidHTML D/dalvikvm﹕ GC_FOR_ALLOC freed 76K, 5% free 3423K/3576K, paused 5ms, total 7ms
04-04 15:49:37.323 2088-2088/com.exercise.AndroidHTML D/dalvikvm﹕ GC_FOR_ALLOC freed 2K, 5% free 3643K/3800K, paused 4ms, total 7ms
04-04 15:49:37.323 2088-2088/com.exercise.AndroidHTML I/dalvikvm-heap﹕ Grow heap (frag case) to 6.047MB for 2536932-byte allocation
04-04 15:49:37.343 2088-2102/com.exercise.AndroidHTML D/dalvikvm﹕ GC_FOR_ALLOC freed 1K, 3% free 6119K/6280K, paused 2ms, total 2ms
04-04 15:49:37.733 2088-2088/com.exercise.AndroidHTML W/EGL_emulation﹕ eglSurfaceAttrib not implemented
04-04 15:49:37.733 2088-2088/com.exercise.AndroidHTML D/OpenGLRenderer﹕ Enabling debug mode 0
04-04 15:49:37.763 2088-2088/com.exercise.AndroidHTML W/AwContents﹕ nativeOnDraw failed; clearing to background color.
04-04 15:49:38.113 2088-2088/com.exercise.AndroidHTML W/AwContents﹕ nativeOnDraw failed; clearing to background color.
04-04 15:49:38.763 2088-2088/com.exercise.AndroidHTML E/eglCodecCommon﹕ glUtilsParamSize: unknow param 0x00000b44
04-04 15:49:38.773 2088-2088/com.exercise.AndroidHTML E/eglCodecCommon﹕ glUtilsParamSize: unknow param 0x00000bd0
04-04 15:49:38.863 2088-2088/com.exercise.AndroidHTML I/chromium﹕ [INFO:async_pixel_transfer_manager_android.cc(56)] Async pixel transfers not supported
04-04 15:49:39.063 2088-2088/com.exercise.AndroidHTML I/chromium﹕ [INFO:async_pixel_transfer_manager_android.cc(56)] Async pixel transfers not supported
04-04 15:49:39.103 2088-2088/com.exercise.AndroidHTML E/eglCodecCommon﹕ **** ERROR unknown type 0x0 (glSizeof,72)
04-04 15:49:39.153 2088-2088/com.exercise.AndroidHTML E/eglCodecCommon﹕ glUtilsParamSize: unknow param 0x00000b44
04-04 15:49:39.153 2088-2088/com.exercise.AndroidHTML E/eglCodecCommon﹕ glUtilsParamSize: unknow param 0x00000bd0
04-04 15:49:39.173 2088-2088/com.exercise.AndroidHTML E/eglCodecCommon﹕ **** ERROR unknown type 0x0 (glSizeof,72)
04-04 15:49:39.183 2088-2088/com.exercise.AndroidHTML E/eglCodecCommon﹕ glUtilsParamSize: unknow param 0x00000b44
04-04 15:49:39.193 2088-2088/com.exercise.AndroidHTML E/eglCodecCommon﹕ glUtilsParamSize: unknow param 0x00000bd0
04-04 15:49:39.233 2088-2088/com.exercise.AndroidHTML E/eglCodecCommon﹕ **** ERROR unknown type 0x0 (glSizeof,72)
04-04 15:49:40.913 2088-2088/com.exercise.AndroidHTML E/eglCodecCommon﹕ glUtilsParamSize: unknow param 0x00000b44
04-04 15:49:40.923 2088-2088/com.exercise.AndroidHTML E/eglCodecCommon﹕ glUtilsParamSize: unknow param 0x00000bd0
04-04 15:49:40.943 2088-2088/com.exercise.AndroidHTML E/eglCodecCommon﹕ **** ERROR unknown type 0x0 (glSizeof,72)
04-04 15:49:41.013 2088-2088/com.exercise.AndroidHTML I/chromium﹕ [INFO:CONSOLE(132)] "Uncaught TypeError: Object [object Object] has no method 'ReadDB'", source: file:///android_asset/index.html (132)
04-04 15:49:41.923 2088-2088/com.exercise.AndroidHTML I/Choreographer﹕ Skipped 48 frames! The application may be doing too much work on its main thread.
04-04 15:49:41.923 2088-2088/com.exercise.AndroidHTML E/eglCodecCommon﹕ glUtilsParamSize: unknow param 0x00000b44
04-04 15:49:41.933 2088-2088/com.exercise.AndroidHTML E/eglCodecCommon﹕ glUtilsParamSize: unknow param 0x00000bd0
04-04 15:49:42.063 2088-2088/com.exercise.AndroidHTML E/eglCodecCommon﹕ **** ERROR unknown type 0x0 (glSizeof,72)
04-04 15:49:42.133 2088-2088/com.exercise.AndroidHTML E/eglCodecCommon﹕ glUtilsParamSize: unknow param 0x00000b44
04-04 15:49:42.143 2088-2088/com.exercise.AndroidHTML E/eglCodecCommon﹕ glUtilsParamSize: unknow param 0x00000bd0
04-04 15:49:42.153 2088-2088/com.exercise.AndroidHTML E/eglCodecCommon﹕ **** ERROR unknown type 0x0 (glSizeof,72)
04-04 15:49:42.273 2088-2088/com.exercise.AndroidHTML E/eglCodecCommon﹕ glUtilsParamSize: unknow param 0x00000b44
04-04 15:49:42.283 2088-2088/com.exercise.AndroidHTML E/eglCodecCommon﹕ glUtilsParamSize: unknow param 0x00000bd0
04-04 15:49:43.103 2088-2088/com.exercise.AndroidHTML E/eglCodecCommon﹕ **** ERROR unknown type 0x0 (glSizeof,72)
04-04 15:49:43.103 2088-2088/com.exercise.AndroidHTML I/Choreographer﹕ Skipped 49 frames! The application may be doing too much work on its main thread.
回答by Juan C. V.
The error occurs only with the Android emulator, and is caused by having checked the "Use GPU Host" in the Android Virtual Device Manager. If you disable this option, the error will disappear, but the emulator will have a much worse performance.
该错误仅发生在 Android 模拟器上,并且是由于在 Android 虚拟设备管理器中选中了“使用 GPU 主机”引起的。如果禁用此选项,错误将消失,但模拟器的性能会差很多。
The other thing you can do is add this to the logcat filter to remove these messages:
您可以做的另一件事是将其添加到 logcat 过滤器以删除这些消息:
Log Tag (regex): ^ (?! (eglCodecCommon))
日志标签(正则表达式): ^ (?! (eglCodecCommon))
I hope it helped you
我希望它对你有帮助
回答by Fathur Rohim
I also have problem before, I trying to load Chatango on webview, then my problem solved using this code, try this:
我之前也有问题,我尝试在 webview 上加载 Chatango,然后使用此代码解决了我的问题,试试这个:
import android.webkit.WebSettings; //dont forget import WebSettings
then webView attribute:
然后 webView 属性:
webView.getSettings().setJavaScriptEnabled(true);
webView.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);
WebSettings websettings = webView.getSettings();
websettings.setJavaScriptEnabled(true);
websettings.setDomStorageEnabled(true);
websettings.setUserAgentString("Mozilla/5.0 (Linux; Android 4.1.2; C1905 Build/15.1.C.2.8) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1847.114 Mobile Safari/537.36");
webView.loadUrl(yourUrltoLoad);