如何解决 Android 系统库崩溃问题 (libwebcore.so)
我的 Android webview 崩溃了,来自 adb logcat 的错误转储告诉我 libwebcore.so 是导致分段错误的库。您如何解决这个问题?
我最初的研究将我带到了这样的地方:How to use addr2line in Android,本质上是说获取库的非剥离版本并使用 addr2line 实用程序来查明导致分段错误的确切行
上面的线程说“使用 obj/local/armeabi 下的 .so 文件,因为这是未剥离的版本”...但我在 /usr/local/android-ndk-r6 或 /usr/local/android 下的任何地方都找不到 libwebcore.so -sdk-mac_86 在我的 Mac 上,我只在 Android 设备上的 /system/lib 下找到了 libwebcore.so 的剥离版本。
有没有办法让我获得 libwebcore.so 的非剥离版本?或者我只是没有以正确的方式处理这件事?
作为参考,以下是 adb logcat 吐出的错误转储:
I/DEBUG ( 65): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
I/DEBUG ( 65): Build fingerprint: 'google/passion/passion:2.3.4/GRJ22/121341:user/release-keys'
I/DEBUG ( 65): pid: 611, tid: 618 >>> com.swishly.gap <<<
I/DEBUG ( 65): signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 00000000
I/DEBUG ( 65): r0 00000002 r1 002f9564 r2 00000003 r3 008e79c8
I/DEBUG ( 65): r4 00000000 r5 002f9700 r6 00000000 r7 4470baf4
I/DEBUG ( 65): r8 4470bb64 r9 44520ea8 10 002ae048 fp 00000000
I/DEBUG ( 65): ip 00000000 sp 4470bad0 lr a851857b pc a851838e cpsr 00000030
I/DEBUG ( 65): d0 0061006300000000 d1 0064006500680000
I/DEBUG ( 65): d2 0077007400650000 d3 004c006b00720000
I/DEBUG ( 65): d4 007400610063006f d5 0053006e006f0069
I/DEBUG ( 65): d6 006300720075006f d7 0000000000000065
I/DEBUG ( 65): d8 0000000000000000 d9 0000000000000000
I/DEBUG ( 65): d10 0000000000000000 d11 0000000000000000
I/DEBUG ( 65): d12 0000000000000000 d13 0000000000000000
I/DEBUG ( 65): d14 0000000000000000 d15 0000000000000000
I/DEBUG ( 65): d16 41d39d979893f080 d17 41d39d9b0a07ff06
I/DEBUG ( 65): d18 41106a1000000000 d19 4024000000000000
I/DEBUG ( 65): d20 0000000000000000 d21 0000000000000000
I/DEBUG ( 65): d22 4024000000000000 d23 0000000000000000
I/DEBUG ( 65): d24 0000000000000000 d25 3ff0000000000000
I/DEBUG ( 65): d26 0000000000000000 d27 bff0000000000000
I/DEBUG ( 65): d28 0000000000000000 d29 3ff0000000000000
I/DEBUG ( 65): d30 0000000000000000 d31 3ff0000000000000
I/DEBUG ( 65): scr 20000013
I/DEBUG ( 65):
I/DEBUG ( 65): #00 pc 0021838e /system/lib/libwebcore.so
I/DEBUG ( 65): #01 pc 00218576 /system/lib/libwebcore.so
I/DEBUG ( 65): #02 pc 002186f8 /system/lib/libwebcore.so
I/DEBUG ( 65): #03 pc 0021873a /system/lib/libwebcore.so
I/DEBUG ( 65): #04 pc 0021875c /system/lib/libwebcore.so
I/DEBUG ( 65): #05 pc 0021879a /system/lib/libwebcore.so
I/DEBUG ( 65): #06 pc 0021febe /system/lib/libwebcore.so
I/DEBUG ( 65): #07 pc 00220df0 /system/lib/libwebcore.so
I/DEBUG ( 65): #08 pc 0022147c /system/lib/libwebcore.so
I/DEBUG ( 65): #09 pc 00017e34 /system/lib/libdvm.so
I/DEBUG ( 65):
I/DEBUG ( 65): code around pc:
I/DEBUG ( 65): a851836c 602303c2 eb03e002 602003c2 46206063
I/DEBUG ( 65): a851837c bf00bd70 b510680b b1134604 1c426818
I/DEBUG ( 65): a851838c 6820601a f7ff6023 4620fd55 bf00bd10
I/DEBUG ( 65): a851839c 4604b510 fd1ef7ff f6534620 4620fa73
I/DEBUG ( 65): a85183ac bf00bd10 4604b570 460e6cc0 f6acb168
I/DEBUG ( 65):
I/DEBUG ( 65): code around lr:
I/DEBUG ( 65): a8518558 d10242a5 2600462c 6823e017 f1b3b113
I/DEBUG ( 65): a8518568 d1f83fff e7f33408 1d216878 f7ff1980
I/DEBUG ( 65): a8518578 3408ff03 d00642a5 2b006823 f1b3d0f9
I/DEBUG ( 65): a8518588 d1013fff 462ce7f5 42ac3604 e8bdd1ec
I/DEBUG ( 65): a8518598 bf0081f0 b087b5f0 0710f100 4604ae03
I/DEBUG ( 65):
I/DEBUG ( 65): stack:
I/DEBUG ( 65): 4470ba90 00953a1c
I/DEBUG ( 65): 4470ba94 a83da669 /system/lib/libwebcore.so
I/DEBUG ( 65): 4470ba98 9de0413c
I/DEBUG ( 65): 4470ba9c 00000001
I/DEBUG ( 65): 4470baa0 00953a18
I/DEBUG ( 65): 4470baa4 0000a000
I/DEBUG ( 65): 4470baa8 4470bb64
I/DEBUG ( 65): 4470baac 44520ea8
I/DEBUG ( 65): 4470bab0 002ae048
I/DEBUG ( 65): 4470bab4 afd1362d /system/lib/libc.so
I/DEBUG ( 65): 4470bab8 4470baf4
I/DEBUG ( 65): 4470babc 00953a1c
My Android webview is crashing and the error dump from adb logcat tells me that libwebcore.so is the library causing the segmentation fault. How do you troubleshoot this?
My initial research took me to places like this thread: How to use addr2line in Android, which in essence says to get the non-stripped version of the library and use the addr2line utility to pinpoint the exact line causing the segmentation fault
The thread above says "Use the .so file under obj/local/armeabi, since this is the non-stripped version"...but I couldn't find libwebcore.so anywhere under /usr/local/android-ndk-r6 or /usr/local/android-sdk-mac_86 on my Mac, and I only found a stripped version of libwebcore.so under /system/lib on the Android device.
Is there a way I can get my hands on a non-stripped version of libwebcore.so? Or am I just not going about this the right way?
For reference, here is the error dump as spit out by adb logcat:
I/DEBUG ( 65): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
I/DEBUG ( 65): Build fingerprint: 'google/passion/passion:2.3.4/GRJ22/121341:user/release-keys'
I/DEBUG ( 65): pid: 611, tid: 618 >>> com.swishly.gap <<<
I/DEBUG ( 65): signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 00000000
I/DEBUG ( 65): r0 00000002 r1 002f9564 r2 00000003 r3 008e79c8
I/DEBUG ( 65): r4 00000000 r5 002f9700 r6 00000000 r7 4470baf4
I/DEBUG ( 65): r8 4470bb64 r9 44520ea8 10 002ae048 fp 00000000
I/DEBUG ( 65): ip 00000000 sp 4470bad0 lr a851857b pc a851838e cpsr 00000030
I/DEBUG ( 65): d0 0061006300000000 d1 0064006500680000
I/DEBUG ( 65): d2 0077007400650000 d3 004c006b00720000
I/DEBUG ( 65): d4 007400610063006f d5 0053006e006f0069
I/DEBUG ( 65): d6 006300720075006f d7 0000000000000065
I/DEBUG ( 65): d8 0000000000000000 d9 0000000000000000
I/DEBUG ( 65): d10 0000000000000000 d11 0000000000000000
I/DEBUG ( 65): d12 0000000000000000 d13 0000000000000000
I/DEBUG ( 65): d14 0000000000000000 d15 0000000000000000
I/DEBUG ( 65): d16 41d39d979893f080 d17 41d39d9b0a07ff06
I/DEBUG ( 65): d18 41106a1000000000 d19 4024000000000000
I/DEBUG ( 65): d20 0000000000000000 d21 0000000000000000
I/DEBUG ( 65): d22 4024000000000000 d23 0000000000000000
I/DEBUG ( 65): d24 0000000000000000 d25 3ff0000000000000
I/DEBUG ( 65): d26 0000000000000000 d27 bff0000000000000
I/DEBUG ( 65): d28 0000000000000000 d29 3ff0000000000000
I/DEBUG ( 65): d30 0000000000000000 d31 3ff0000000000000
I/DEBUG ( 65): scr 20000013
I/DEBUG ( 65):
I/DEBUG ( 65): #00 pc 0021838e /system/lib/libwebcore.so
I/DEBUG ( 65): #01 pc 00218576 /system/lib/libwebcore.so
I/DEBUG ( 65): #02 pc 002186f8 /system/lib/libwebcore.so
I/DEBUG ( 65): #03 pc 0021873a /system/lib/libwebcore.so
I/DEBUG ( 65): #04 pc 0021875c /system/lib/libwebcore.so
I/DEBUG ( 65): #05 pc 0021879a /system/lib/libwebcore.so
I/DEBUG ( 65): #06 pc 0021febe /system/lib/libwebcore.so
I/DEBUG ( 65): #07 pc 00220df0 /system/lib/libwebcore.so
I/DEBUG ( 65): #08 pc 0022147c /system/lib/libwebcore.so
I/DEBUG ( 65): #09 pc 00017e34 /system/lib/libdvm.so
I/DEBUG ( 65):
I/DEBUG ( 65): code around pc:
I/DEBUG ( 65): a851836c 602303c2 eb03e002 602003c2 46206063
I/DEBUG ( 65): a851837c bf00bd70 b510680b b1134604 1c426818
I/DEBUG ( 65): a851838c 6820601a f7ff6023 4620fd55 bf00bd10
I/DEBUG ( 65): a851839c 4604b510 fd1ef7ff f6534620 4620fa73
I/DEBUG ( 65): a85183ac bf00bd10 4604b570 460e6cc0 f6acb168
I/DEBUG ( 65):
I/DEBUG ( 65): code around lr:
I/DEBUG ( 65): a8518558 d10242a5 2600462c 6823e017 f1b3b113
I/DEBUG ( 65): a8518568 d1f83fff e7f33408 1d216878 f7ff1980
I/DEBUG ( 65): a8518578 3408ff03 d00642a5 2b006823 f1b3d0f9
I/DEBUG ( 65): a8518588 d1013fff 462ce7f5 42ac3604 e8bdd1ec
I/DEBUG ( 65): a8518598 bf0081f0 b087b5f0 0710f100 4604ae03
I/DEBUG ( 65):
I/DEBUG ( 65): stack:
I/DEBUG ( 65): 4470ba90 00953a1c
I/DEBUG ( 65): 4470ba94 a83da669 /system/lib/libwebcore.so
I/DEBUG ( 65): 4470ba98 9de0413c
I/DEBUG ( 65): 4470ba9c 00000001
I/DEBUG ( 65): 4470baa0 00953a18
I/DEBUG ( 65): 4470baa4 0000a000
I/DEBUG ( 65): 4470baa8 4470bb64
I/DEBUG ( 65): 4470baac 44520ea8
I/DEBUG ( 65): 4470bab0 002ae048
I/DEBUG ( 65): 4470bab4 afd1362d /system/lib/libc.so
I/DEBUG ( 65): 4470bab8 4470baf4
I/DEBUG ( 65): 4470babc 00953a1c
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以使用 Kerubu 提供的链接查看整个 WebKit xcode 项目以及整个 Android 开源项目(我几个月前做过,它需要多个 GB 和几个小时...),并可能创建您自己的未剥离的 .so 库(我没有),但我怀疑这是解决这个问题的最简单方法。
编辑:事实证明android在github上有镜像,这是WebCore项目。
您的应用程序很可能比 WebKit 项目更容易排除故障!
我允许自己大胆猜测:
javascript 存在已知错误注入(也可此处)仅适用于某些设备这似乎影响了一些 html应用程序框架(例如PhoneGap,显然),您是否使用方法
addJavascriptInterface
?如果是这样,有一个解决方法,调用WebChromeClient
的onJsPrompt
并解析字符串以从 Web 视图执行本机调用。Java 到 javascript:
javascript 到 java:
在 javascript:
和在 java:
You can checkout the whole WebKit xcode project along with the whole Android open source project with the link Kerubu provided (I did a few months ago, it takes multiple gigabytes & hours...) and probably create your own unstripped .so library (I didn't), but I doubt this is the easiest way to take on this issue.
Edit: it turns out android is mirrored on github, here's the WebCore project.
There is a good chance that your application is far easier to troubleshoot than the WebKit project!
I'll allow myself to throw a wild guess:
There are known bugs with javascript injection (also here) for some devices only that seem to be affecting some html app framework as well (such as PhoneGap, apparently), do you use the method
addJavascriptInterface
? If so there is a workaround, calling theWebChromeClient
'sonJsPrompt
and parsing the string to perform native calls from the webview.Java to javascript:
javascript to java:
in javascript:
and in java:
不是 100% 确定,但可以在 Android 开源项目中找到 libwebkit.so 的源代码吗?
Not 100% sure but is the source for libwebkit.so to be found in Android Open Source Project?