Encounter a strange problem:
WebView display a local H5 page, in Mi 2S can be displayed, the same properties on the page button has two clickable, but the third button click Cause activity must crash. Crash without verbose log, only the following two lines of clues:
// W/crash_handler(19125): Caught a crash, signum=11
// 14594-14594/com.eln.base E/webcore: Report WebCore crash to the ErrorReportUtils at:Wed Oct 28 18:44:51 格林尼治标准时间+0800 2015 //blog from sodino.com
This page is normal for other phones, including Xiaomi, which only appears in Mi 2S.
H5 developer Follow-up found that the crash point is a crash in the rendering phase of the H5 interface, and no further workaround.
Go to dinner while walking on the road considering that Android and rendering are related to hardware acceleration ;
Check the code back to find the entire app in AndroidManifest.xml the application label at global turn on hardware acceleration,
So when the hardware acceleration switch is set to OFF, the webview is found to be android:hardwareAccelerated="false" normal.
Subsequent to further reduce the scope of the impact of code churn, the solution to circumvent this bug is set to:
1. When determining the MI 2 series phone
2. Turn off hardware acceleration for the WebView interface
// if ("MI 2SC".equals(deviceName)) {
if (deviceName!= null && deviceName.toLowerCase().startsWith("mi 2")) {
mWebView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
}
Attached: [Android official hardware acceleration Control level description on different interfaces] (
http://developer.android.com/intl/zh-cn/guide/topics/graphics/hardware-accel.html)
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
[Android] ' webview--caught a crash, signum=11 ' 's solution