android2.3上用WebView组件js和java相互调用报错

Android2.3中Webkit引擎导致VM崩溃的问题
WARN/dalvikvm(429): JNI WARNING: jarray 0x405986b0 points to non-array object (Ljava/lang/String;)
INFO/dalvikvm(429): "WebViewCoreThread" prio=5 tid=9 NATIVE
INFO/dalvikvm(429):   | group="main" sCount=0 dsCount=0 obj=0x405346e0 self=0x25b558
INFO/dalvikvm(429):   | sysTid=563 nice=0 sched=0/0 cgrp=default handle=2866504
INFO/dalvikvm(429):   | schedstat=( 496679324 479902011 97 )
INFO/dalvikvm(429):   at android.webkit.LoadListener.nativeFinished(Native Method)
INFO/dalvikvm(429):   at android.webkit.LoadListener.nativeFinished(Native Method)
INFO/dalvikvm(429):   at android.webkit.LoadListener.tearDown(LoadListener.java:1200)
INFO/dalvikvm(429):   at android.webkit.LoadListener.handleEndData(LoadListener.java:721)
INFO/dalvikvm(429):   at android.webkit.LoadListener.handleMessage(LoadListener.java:219)
INFO/dalvikvm(429):   at android.os.Handler.dispatchMessage(Handler.java:99)
INFO/dalvikvm(429):   at android.os.Looper.loop(Looper.java:123)
INFO/dalvikvm(429):   at android.webkit.WebViewCore$WebCoreThread.run(WebViewCore.java:629)
INFO/dalvikvm(429):   at java.lang.Thread.run(Thread.java:1019)
ERROR/dalvikvm(429): VM aborting
INFO/DEBUG(31): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
INFO/DEBUG(31): Build fingerprint: 'generic/sdk/generic:2.3.1/GSI11/93351:eng/test-keys'
INFO/DEBUG(31): pid: 429, tid: 563  >>> org.mdx <<<
INFO/DEBUG(31): signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr deadd00d
INFO/DEBUG(31):  r0 fffffebc  r1 deadd00d  r2 00000026  r3 00000000
INFO/DEBUG(31):  r4 81da45c8  r5 405986b0  r6 81d859ec  r7 002105f0
INFO/DEBUG(31):  r8 4456bb58  r9 43db9ecc  10 43db9eb4  fp 41edd82c
INFO/DEBUG(31):  ip 81da4728  sp 4456b4c8  lr afd19375  pc 81d45a02  cpsr 20000030
INFO/DEBUG(31):          #00  pc 00045a02  /system/lib/libdvm.so
INFO/DEBUG(31):          #01  pc 000376fc  /system/lib/libdvm.so
INFO/DEBUG(31):          #02  pc 000399c4  /system/lib/libdvm.so
INFO/DEBUG(31):          #03  pc 0003a4a0  /system/lib/libdvm.so
INFO/DEBUG(31):          #04  pc 0032b6e6  /system/lib/libwebcore.so
INFO/DEBUG(31):          #05  pc 002a4db4  /system/lib/libwebcore.so
INFO/DEBUG(31):          #06  pc 001a6146  /system/lib/libwebcore.so
INFO/DEBUG(31):          #07  pc 002a5880  /system/lib/libwebcore.so
INFO/DEBUG(31):          #08  pc 00359e5e  /system/lib/libwebcore.so
INFO/DEBUG(31):          #09  pc 0035d1b6  /system/lib/libwebcore.so
INFO/DEBUG(31):          #10  pc 0036b0a0  /system/lib/libwebcore.so
INFO/DEBUG(31):          #11  pc 003627d8  /system/lib/libwebcore.so
INFO/DEBUG(31):          #12  pc 0029fb34  /system/lib/libwebcore.so
INFO/DEBUG(31):          #13  pc 0023368e  /system/lib/libwebcore.so
INFO/DEBUG(31):          #14  pc 000f5276  /system/lib/libwebcore.so
INFO/DEBUG(31):          #15  pc 000f6ad8  /system/lib/libwebcore.so
INFO/DEBUG(31):          #16  pc 0022a3ea  /system/lib/libwebcore.so
INFO/DEBUG(31):          #17  pc 0022af34  /system/lib/libwebcore.so
INFO/DEBUG(31):          #18  pc 000e2256  /system/lib/libwebcore.so
INFO/DEBUG(31):          #19  pc 000e3ab2  /system/lib/libwebcore.so
INFO/DEBUG(31):          #20  pc 000e3b92  /system/lib/libwebcore.so
INFO/DEBUG(31):          #21  pc 0022add8  /system/lib/libwebcore.so
INFO/DEBUG(31):          #22  pc 0026ee82  /system/lib/libwebcore.so
INFO/DEBUG(31):          #23  pc 000d13ec  /system/lib/libwebcore.so
INFO/DEBUG(31):          #24  pc 000d15cc  /system/lib/libwebcore.so
INFO/DEBUG(31):          #25  pc 00224446  /system/lib/libwebcore.so
INFO/DEBUG(31):          #26  pc 000e2676  /system/lib/libwebcore.so
INFO/DEBUG(31):          #27  pc 000e2696  /system/lib/libwebcore.so
INFO/DEBUG(31):          #28  pc 002719e2  /system/lib/libwebcore.so
INFO/DEBUG(31):          #29  pc 000e39d6  /system/lib/libwebcore.so
INFO/DEBUG(31):          #30  pc 00272d7c  /system/lib/libwebcore.so
INFO/DEBUG(31):          #31  pc 000eac5e  /system/lib/libwebcore.so
INFO/DEBUG(31): code around pc:
INFO/DEBUG(31): 81d459e0 447a4479 ed0cf7d1 20004c09 ee34f7d1 
INFO/DEBUG(31): 81d459f0 447c4808 6bdb5823 d0002b00 49064798 
INFO/DEBUG(31): 81d45a00 700a2226 eea0f7d1 0004361f 000451dd 
INFO/DEBUG(31): 81d45a10 0005ebd2 fffffebc deadd00d b510b40e 
INFO/DEBUG(31): 81d45a20 4c0a4b09 447bb083 aa05591b 6b5bca02 
INFO/DEBUG(31): code around lr:
INFO/DEBUG(31): afd19354 b0834a0d 589c447b 26009001 686768a5 
INFO/DEBUG(31): afd19364 220ce008 2b005eab 1c28d003 47889901 
INFO/DEBUG(31): afd19374 35544306 d5f43f01 2c006824 b003d1ee 
INFO/DEBUG(31): afd19384 bdf01c30 000281a8 ffffff88 1c0fb5f0 
INFO/DEBUG(31): afd19394 43551c3d a904b087 1c16ac01 604d9004 
INFO/DEBUG(31): stack:
INFO/DEBUG(31):     4456b488  00000015  
INFO/DEBUG(31):     4456b48c  afd18407  /system/lib/libc.so
INFO/DEBUG(31):     4456b490  afd4270c  /system/lib/libc.so
INFO/DEBUG(31):     4456b494  afd426b8  /system/lib/libc.so
INFO/DEBUG(31):     4456b498  00000000  
INFO/DEBUG(31):     4456b49c  afd19375  /system/lib/libc.so
INFO/DEBUG(31):     4456b4a0  0025b558  [heap]
INFO/DEBUG(31):     4456b4a4  afd183d9  /system/lib/libc.so
INFO/DEBUG(31):     4456b4a8  002105f0  [heap]
INFO/DEBUG(31):     4456b4ac  0005ebd2  [heap]
INFO/DEBUG(31):     4456b4b0  405986b0  /dev/ashmem/dalvik-heap (deleted)
INFO/DEBUG(31):     4456b4b4  81d859ec  /system/lib/libdvm.so
INFO/DEBUG(31):     4456b4b8  002105f0  [heap]
INFO/DEBUG(31):     4456b4bc  afd18437  /system/lib/libc.so
INFO/DEBUG(31):     4456b4c0  df002777  
INFO/DEBUG(31):     4456b4c4  e3a070ad  
INFO/DEBUG(31): #00 4456b4c8  00000001  
INFO/DEBUG(31):     4456b4cc  81d37701  /system/lib/libdvm.so
INFO/DEBUG(31): #01 4456b4d0  00000001  
INFO/DEBUG(31):     4456b4d4  81d399c9  /system/lib/libdvm.so


在网上查了一下,好像解决办法挺麻烦的,网上的资料都说是2.3的Bug。
Android2.2,2.3,2.3.3都存在的一个bug,在这里有详细的描述。
http://code.google.com/p/android/issues/detail?id=12987
问题的核心在于这样一句话:JNI WARNING: jarray 0x4074f6e0 points to non-array object (Ljava/lang/String;)
也就是进行JNI调用时,把一个Java中的String对象当数组来访问了,最终导致虚拟机崩溃。

在网上查了下,基本算是一个比较严重的BUG,没办法解决,所以如果说用WebView组件想在js和java之间相互调用的话就没办法适应所有机型,所以做android原生应用程序时最好不要用WebView组件,否则2.3系统会直接崩溃掉。

你可能感兴趣的:(android)