Android4.4使用 webview控件报错nativeOnDrawfailed;clearing to background color
来源:互联网 发布:matlab接口编程 编辑:程序博客网 时间:2024/05/17 02:05
最近在整合 apk调用 flash的时候,里面用到 webview控件,然而还是每次打开应用都会提示如下错误:
W/AwContents(2825): nativeOnDraw failed; clearing to background color"
I/chromium( 2825): [INFO:async_pixel_transfer_manager_android.cc(56)] Async pixel transfers not supported
I/chromium( 2825): [INFO:async_pixel_transfer_manager_android.cc(56)] Async pixel transfers not supported
尽管尝试使用网上的一些办法,关掉其硬件加速器,系统用的是 Android 4.4.2 kitkat版本
首先, 我在 manifest文件中关闭了加速器
Androidmanifest.xml
and it did not work
<application
android:name="com.nandish.app.MyApplication"
android:largeHeap="true"
android:hardwareAccelerated="false">
然后再关闭了软件加速器,如下:
setLayerType(View.LAYER_TYPE_SOFTWARE, null);
我还打印了 log, 确定硬件加速是关掉的
if (mWebView.isHardwareAccelerated()){
Log.i("tCute", "HardwareAccelerated ---- webview !!!");
}else {
Log.i("tCute", "NoneHardwareAccelerated ---- webview !!!");
}
最后还是提示错误如下:
W/AwContents(2825): nativeOnDraw failed; clearing to background color" I/chromium( 2825): [INFO:async_pixel_transfer_manager_android.cc(56)] Async pixel transfers not supported I/chromium( 2825): [INFO:async_pixel_transfer_manager_android.cc(56)] Async pixel transfers not supported(2825)
我在国外一个论坛上看到也是这种情况:
I very highly suspect that this has something to do with it:
10-03 18:41:30.765: W/AwContents(22369): nativeOnDraw failed; clearing to background color.
国外有牛人解释如下: Because hardware accelerated canvas rendering is not supported in Chromium WebView, I modify the code to turn off hardware accelerated canvas. now it works.
那么问题来了, 该如何关闭这个 canvas呢?
后来发现,Android 4.4之前支持flash,虽然一直说不再支持 flash的播放,但还是能播放,是因为webkit内核,当初的flash是adobe专为安卓webkit内核开发的,安卓2.3升级到4.0,webkit升级了,原先的flash插件不能用了,adobe又为安卓4.0开发了个新的flash插件,而这个webkit内核,从4.0到4.3一直没变,所以一直能用flash,4.4系统webkit内核换成了chromiun内核,而安卓chromiun不支持flash,这个chromium即是安卓chrome的内核,安卓chrome发布时就声明不支持flash。而adobe在发布安卓4.0专用flash插件后,声明不再开发移动端flash,只负责维护安卓flash,所以一直到安卓4.3,那个安卓flash插件adobe官方还在更新,除非adobe开发安卓chromium内核的flash。
另外一个很重要原因,Flash靠对客户端的高资源占用率来获取传输过程的低带宽占用,Flash能节省带宽资源,客户端应用也相对简单;随着Adobe对Flash不断做加法,其客户端应用研发已经处于失控状态:一些并不复杂的应用,即便在配置很高的PC跑起来都不能保证流畅,即便Adobe宣布支持硬件加速后,这种情况依然没有改善。Flash目前唯一的优势就是开发人员及装机量。而Apple做产品的思路,则是宁缺勿滥:如果不能保证系统流畅度,就暂时不采用。对Flash就是如此。首先是流畅度问题,其次是对硬件资源消耗无法控制(试想一下在开心网偷半个小时的菜就导致手机没电了),最后还有漏洞,对iOS系统安全也是威胁。此外,客户端互动技术也不是Adobe一家独有,还有很多更加先进、公开的标准化技术可供选择,因此Flash得不到iOS支持就顺理成章了。目前安卓4.4也抛弃了flash,看来flash没希望了。
目前 Android 4.4 上尝试网上很多其它方法,结果发现还是不行,连本地的 swf文件都打不开,我在想目前那很多手机,比如小米 MI4、魅族 MX4以及其“中华酷联”是如何解决这个问题的。那么基于 swf的应用是否从此告急了。 从另外一方面来说,既然谷歌已经把 webkit这个拿掉了,即便用某种破解方法能播放 flash,那么后期因 flash带来的问题又有谁能去解决呢? 这个 flash在Android系统上存在又有什么意义呢。
0 6
- Android4.4使用 webview控件报错nativeOnDrawfailed;clearing to background color
- 优化WebView nativeOnDraw failed; clearing to background color及其根本原因
- set button background to color
- QT中使用webView控件时未定义报错
- angular ngDialog background color to be transplant
- background-color
- Android4.4之WebView
- Android4.4webview杂记
- 编译android4.4 报错error: call to '__property_get_too_small_error' declared with attribute 的处理
- How To Change the Background Color of a Tab Control
- How to change tooltip background color in Unity?
- how to change the background color of actionbar
- set transparent button image and background color to button
- How to customize the background color of a UITableViewCell?
- qt 之 How to Change the Background Color of QWidget
- color报错
- 使用javascript將background-Color修改為backgroundColor.
- color selector的使用报错问题探讨
- jquery cookie操作
- 简单的SSH整合登录注册
- 求最大数
- 基于物联网操作系统HelloX的智慧家庭体系架构
- 观察者模式(C语言实现)
- Android4.4使用 webview控件报错nativeOnDrawfailed;clearing to background color
- Android五种数据传递方法汇总
- 关于新技术学习的10点建议
- Android_TabHost用户界面之一_140930
- 关于 delete 的解释
- UVa-674-Coin Change
- UML类图详解
- 黑马程序员--Java高级--网络编程学习1
- grep