Android Webview: Crash After Url Loading
Solution 1:
// Edit: Found it! The culprit in on line 2540 in general.css
:
#head-search-form{display: block;margin: 30px0;}
More specifically, it's display: block
that somehow makes the WebView
choke. I'm not much of a web developer, but exchanging the value with flex
or none
seems to no longer result in a crash (and I couldn't tell the visual difference on a mobile device). Hope that helps!
I've set up a small test project and have been able to reproduce the crash on a (virtual) Android 4.1 device. It only seems to happens upon scrolling, after the page has fully loaded. I.e. you can expand the menu drawer without any issues, as long as you don't start scrolling...
I was able to narrow down the culprit to general.css
. As soon as you don't load that style sheet, the page will work and scroll just fine, but of course won't look very pretty.
Since general.css
counts 3300+ lines, I'd suggest you start your search for the actual cause by fixing the errors indicated by the W3C CSS Validator. If that doesn't solve the issue, start disabling style rules related to the photo grid, especially anything that involves animation/transformation. If I can find the time, I may have a go at this myself too.
Just for your information, here's a more extensive stack trace. Someone else may be able to find some more pointers in there too.
mh.test.webview A/libc:Fatalsignal11(SIGSEGV)at0x00001f08(code=1),thread11949(WebViewCoreThre)I/DEBUG:************************************************I/DEBUG: Build fingerprint:'generic/vbox86p/vbox86p:4.1.1/JRO03S/eng.buildbot.20151117.133415:userdebug/test-keys'I/DEBUG: pid:11930,tid:11949,name:WebViewCoreThre>>>mh.test.webview<<<I/DEBUG:signal11(SIGSEGV),code1(SEGV_MAPERR),faultaddr00001f08I/DEBUG:eaxb84902e4ebx9ba8b488ecxb804b028edxb83c0224I/DEBUG:esib8490360edib804b028I/DEBUG:xcs00000073xds0000007bxes0000007bxfs00000000xss0000007bI/DEBUG:eip00001f08ebp997b9748esp997b96dcflags00010296I/DEBUG:#00 pc 00001f08 <unknown>I/DEBUG:#01 pc 00344fd6 /system/lib/libwebcore.so (WebCore::RenderLayerCompositor::computeCompositingRequirements(WebCore::RenderLayer*, WTF::HashMap<WebCore::RenderLayer*, WebCore::IntRect, WTF::PtrHash<WebCore::RenderLayer*>, WTF::HashTraits<WebCore::RenderLayer*>, WTF::HashTraits<WebCore::IntRect> >*, WebCore::CompositingState&, bool&)+38)I/DEBUG:#02 pc 003454bb /system/lib/libwebcore.so (WebCore::RenderLayerCompositor::computeCompositingRequirements(WebCore::RenderLayer*, WTF::HashMap<WebCore::RenderLayer*, WebCore::IntRect, WTF::PtrHash<WebCore::RenderLayer*>, WTF::HashTraits<WebCore::RenderLayer*>, WTF::HashTraits<WebCore::IntRect> >*, WebCore::CompositingState&, bool&)+1291)I/DEBUG:#03 pc 003454bb /system/lib/libwebcore.so (WebCore::RenderLayerCompositor::computeCompositingRequirements(WebCore::RenderLayer*, WTF::HashMap<WebCore::RenderLayer*, WebCore::IntRect, WTF::PtrHash<WebCore::RenderLayer*>, WTF::HashTraits<WebCore::RenderLayer*>, WTF::HashTraits<WebCore::IntRect> >*, WebCore::CompositingState&, bool&)+1291)I/DEBUG:#04 pc 003454bb /system/lib/libwebcore.so (WebCore::RenderLayerCompositor::computeCompositingRequirements(WebCore::RenderLayer*, WTF::HashMap<WebCore::RenderLayer*, WebCore::IntRect, WTF::PtrHash<WebCore::RenderLayer*>, WTF::HashTraits<WebCore::RenderLayer*>, WTF::HashTraits<WebCore::IntRect> >*, WebCore::CompositingState&, bool&)+1291)I/DEBUG:#05 pc 003454bb /system/lib/libwebcore.so (WebCore::RenderLayerCompositor::computeCompositingRequirements(WebCore::RenderLayer*, WTF::HashMap<WebCore::RenderLayer*, WebCore::IntRect, WTF::PtrHash<WebCore::RenderLayer*>, WTF::HashTraits<WebCore::RenderLayer*>, WTF::HashTraits<WebCore::IntRect> >*, WebCore::CompositingState&, bool&)+1291)I/DEBUG:#06 pc 00346c55 /system/lib/libwebcore.so (WebCore::RenderLayerCompositor::updateCompositingLayers(WebCore::CompositingUpdateType, WebCore::RenderLayer*)+213)I/DEBUG:#07 pc 0020e727 /system/lib/libwebcore.so (WebCore::FrameView::layout(bool)+1159)I/DEBUG:#08 pc 0068126f /system/lib/libwebcore.so (WebCore::Document::updateLayout()+127)I/DEBUG:#09 pc 0068bbda /system/lib/libwebcore.so (WebCore::Document::updateLayoutIgnorePendingStylesheets()+90)I/DEBUG:#10 pc 005ead53 /system/lib/libwebcore.so (WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue(int, WebCore::EUpdateLayout) const+467)I/DEBUG:#11 pc 005f35e9 /system/lib/libwebcore.so (WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue(int) const+41)I/DEBUG:#12 pc 005e68d7 /system/lib/libwebcore.so (WebCore::CSSComputedStyleDeclaration::getPropertyValue(int) const+55)I/DEBUG:#13 pc 006297f8 /system/lib/libwebcore.so (WebCore::CSSStyleDeclaration::getPropertyValue(WTF::String const&)+88)I/DEBUG:#14 pc 004d9475 /system/lib/libwebcore.so (WebCore::CSSStyleDeclarationInternal::getPropertyValueCallback(v8::Arguments const&)+181)I/DEBUG:#15 pc 000efdd4 <unknown>I/DEBUG:#16 pc 0005cf6b <unknown>I/DEBUG:#17 pc 000bb32f <unknown>I/DEBUG:#18 pc 00003b41 <unknown>I/DEBUG:#19 pc 000f47ce <unknown>I/DEBUG:#20 pc 0001a5a3 <unknown>I/DEBUG:#21 pc 000065e3 <unknown>I/DEBUG:#22 pc 00003b41 <unknown>I/DEBUG:#23 pc 00024c59 <unknown>I/DEBUG:#24 pc 00024dad <unknown>I/DEBUG:#25 pc 00003b41 <unknown>I/DEBUG:#26 pc 0001a59c <unknown>I/DEBUG:#27 pc 000d7172 <unknown>I/DEBUG:#28 pc 0001a5a3 <unknown>I/DEBUG:#29 pc 000d40ed <unknown>I/DEBUG:#30 pc 00017bf9 <unknown>I/DEBUG:#31 pc 00008c2a <unknown>I/DEBUG:997b969c00000000I/DEBUG:997b96a000000000I/DEBUG:997b96a400000000I/DEBUG:997b96a800000000I/DEBUG:997b96ac00000000I/DEBUG:997b96b000000000I/DEBUG:997b96b400000000I/DEBUG:997b96b800000000I/DEBUG:997b96bc00000000I/DEBUG:997b96c000000000I/DEBUG:997b96c400000000I/DEBUG:997b96c800000000I/DEBUG:997b96cc00000000I/DEBUG:997b96d000000000I/DEBUG:997b96d400000000I/DEBUG:997b96d800000000I/DEBUG:#00 997b96dc 9ad1cdd4 /system/lib/libwebcore.so (WebCore::RenderLayer::updateLayerPosition()+52)I/DEBUG:997b96e0b84902e4 [heap]
I/DEBUG:997b96e4b8490090 [heap]
I/DEBUG:997b96e80000000fI/DEBUG:997b96ec0000002fI/DEBUG:997b96f0b8490090 [heap]
I/DEBUG:997b96f400000001I/DEBUG:997b96f89ad2204e/system/lib/libwebcore.so(WebCore::RenderLayer::repaintIncludingNonCompositingDescendants(WebCore::RenderBoxModelObject*)+14)I/DEBUG:997b96fcb827f428 [heap]
I/DEBUG:997b97009ba8b488/system/lib/libwebcore.soI/DEBUG:997b9704b8490090 [heap]
I/DEBUG:997b9708997b9748 [stack:11949]
I/DEBUG:997b970c9ad35d38/system/lib/libwebcore.so(WebCore::RenderLayerCompositor::updateBacking(WebCore::RenderLayer*,WebCore::RenderLayerCompositor::CompositingChangeRepaint)+344)I/DEBUG:997b9710b8490014 [heap]
I/DEBUG:997b9714b848fe3c [heap]
I/DEBUG:997b971800000012I/DEBUG:................I/DEBUG:#01 997b9750 b8490360 [heap]I/DEBUG:997b9754b8490090 [heap]
I/DEBUG:997b975800000000I/DEBUG:997b975c997b98e0 [stack:11949]
I/DEBUG:997b9760997ba84f [stack:11949]
I/DEBUG:997b9764b843a9e4 [heap]
I/DEBUG:997b976800000034I/DEBUG:997b976c00000180I/DEBUG:997b9770b848fe3c [heap]
I/DEBUG:997b9774b85257f8 [heap]
I/DEBUG:997b97789ace0300/system/lib/libwebcore.so(WebCore::RenderBox::dirtyLineBoxes(bool)+80)I/DEBUG:997b977c43400000I/DEBUG:997b9780b83fe51c [heap]
I/DEBUG:997b9784997b9788 [stack:11949]
I/DEBUG:997b9788004a0000I/DEBUG:997b978cb848feb8 [heap]
I/DEBUG:................I/DEBUG:#02 997b9aa0 b804b028 [heap]I/DEBUG:997b9aa4b8490360 [heap]
I/DEBUG:997b9aa800000000I/DEBUG:997b9aac997b9c30 [stack:11949]
I/DEBUG:997b9ab0997ba84f [stack:11949]
I/DEBUG:997b9ab4b83fe51c [heap]
I/DEBUG:997b9ab800000000I/DEBUG:997b9abc00000001I/DEBUG:997b9ac0b86fd038 [heap]
I/DEBUG:997b9ac4b86fd368 [heap]
I/DEBUG:997b9ac8997b9b48 [stack:11949]
I/DEBUG:997b9acc9adac54a/system/lib/libwebcore.so(WebCore::TransformState::move(int,int,WebCore::TransformState::TransformAccumulation)+58)I/DEBUG:997b9ad0b83fe678 [heap]
I/DEBUG:997b9ad4b8294d4c [heap]
I/DEBUG:997b9ad800580b05I/DEBUG:997b9adcb83fe770 [heap]
I/DEBUG:................I/DEBUG:(nomapbelow)I/DEBUG:(nomapforaddress)I/DEBUG:20c1e000-20c1f000
Solution 2:
Are you are using a customized version of Android ? a specific mod? if you do - there is always a chance the problem is a result of that ROM. There have been cases where a WebView has experienced problems in specific version of Android or on specific ROMs. Some link: https://code.google.com/p/chromium/issues/detail?id=481420http://googlechromereleases.blogspot.com.au/2015/04/android-webview-stable-update.htmlhttp://forum.xda-developers.com/verizon-htc-one-m8/help/android-webviewer-update-huge-turd-t3091192/post60333480#post60333480Android System WebView crashes Android apps! "Tombstones are disabled on JB MR2+ user builds"
Check if you WebView is up to date. if it is - uninstall the updates and check if the problem is still there. If it's NOT up to date - do an update and check if the problem persist. most chances it won't.
In addition - this problem will probably not happen much. in most devices that I've worked with - WebView is reliable and stable.
good luck.
Solution 3:
I had a similar issue after loading a google maps object/or any 2d canvas object in a web view on my Nexus 5X and Nexus 6P device running Android 6.0.x.
I appears though that this related to a hardware bug reported here: https://code.google.com/p/chromium/issues/detail?id=541145
A fix or workaround seems to be on it's way in upcoming webview versions.
Until the new webview version comes I had to go with the proposed fix of setting the webview to software rendering. This makes the map slow but it dosent crash at least.
if(isNexus5xOr6p() && android.os.Build.VERSION.SDK_INT >= 11)
webView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
publicbooleanisNexus5xOr6p() {
if(getDeviceName().contains("nexus 6p") || getDeviceName().contains("nexus 5x"))
returntrue;
elsereturnfalse;
}
publicStringgetDeviceName() {
String manufacturer = Build.MANUFACTURER;
String model = Build.MODEL;
if (model.startsWith(manufacturer)) {
return model.toLowerCase();
}
return (manufacturer + " " + model).toLowerCase();
}
Solution 4:
Try to remove these lines:
wv.clearCache(true);
wv.clearHistory();
wv.setDownloadListener(newDownloadListener() {
@OverridepublicvoidonDownloadStart(String url, String userAgent,
String contentDisposition, String mimetype, long contentLength) {
Intent intent = newIntent(Intent.ACTION_VIEW);
intent.setType(mimetype);
intent.setData(Uri.parse(url));
startActivity(intent);
}
});
wv.setWebChromeClient(newWebChromeClient() {
publicvoidonProgressChanged(WebView view, int progress) {
MainActivity.this.setProgress(progress * 1000);
}
publicbooleanonConsoleMessage(ConsoleMessage cm) {
Log.d("MyProject: WebView: ", cm.message() + " -- From line "
+ cm.lineNumber() + " of "
+ cm.sourceId() );
returntrue;
}
});
It's possible that your version has problem with chrome client
Post a Comment for "Android Webview: Crash After Url Loading"