Webview and HTML5 interactive click crash + solution

Source: Internet
Author: User

07-07 19:06:05. 350: W/dalvikvm (3076): threadid = 4: spin on suspend #4 threadid = 14 (PCF = 0)
07-07 19:06:05. 350: I/dalvikvm (3076): "signal catcher" daemon PRIO = 5 tid = 4 runnable
07-07 19:06:05. 350: I/dalvikvm (3076): | group = "system" scount = 0 dscount = 0 OBJ = 0x40517940 self = 0xf58d0
07-07 19:06:05. 350: I/dalvikvm (3076): | kernel id = 3079 nice = 0 sched = 0/0 MCM = [no-CPU-subsys] handle = 1169736
07-07 19:06:05. 350: I/dalvikvm (3076): | schedstat = (6835933 18493655 53)
07-07 19:06:05. 350: I/dalvikvm (3076): At Dalvik. system. nativestart. Run (native method)
07-07 19:06:05. 350: I/dalvikvm (3076): [<c0296320>] save_stack_trace_tsk + 0x0/0x90
07-07 19:06:05. 350: I/dalvikvm (3076): [<c03b77f4>] proc_pid_stack + 0xf8/0x144
07-07 19:06:05. 350: I/dalvikvm (3076): [<c03b8b58>] proc_single_show + 0x48/0x84
07-07 19:06:05. 350: I/dalvikvm (3076): [<c038d184>] seq_read + 0x26c/0x4e4
07-07 19:06:05. 350: I/dalvikvm (3076): [<c0373d44>] vfs_read + 0xa8/0x150
07-07 19:06:05. 350: I/dalvikvm (3076): [<c0373e98>] sys_read + 0x3c/0x68
07-07 19:06:05. 350: I/dalvikvm (3076): [<c0292740>] ret_fast_syscall + 0x0/0x30
07-07 19:06:05. 350: I/dalvikvm (3076): [<ffffffff>] 0 xffffffff
07-07 19:06:05. 350: I/dalvikvm (3076 ):------------------------------
07-07 19:06:05. 350: I/dalvikvm (3076): "webviewcorethread" PRIO = 5 tid = 14 runnable
07-07 19:06:05. 350: I/dalvikvm (3076): | group = "Main" scount = 1 dscount = 0 OBJ = 0x40614e08 self = 0x279380
07-07 19:06:05. 350: I/dalvikvm (3076): | kernel id = 3165 nice = 0 sched = 0/0 MCM = [no-CPU-subsys] handle = 2523264
07-07 19:06:05. 350: I/dalvikvm (3076): | schedstat = (1820617722 1454437251 4540)
07-07 19:06:05. 350: I/dalvikvm (3076): at Android. WebKit. webviewcore. nativetouchup (native method)
07-07 19:06:05. 350: I/dalvikvm (3076): at Android. WebKit. webviewcore. nativetouchup (native method)
07-07 19:06:05. 350: I/dalvikvm (3076): at Android. WebKit. webviewcore. Access $6500 (webviewcore. Java: 63)
07-07 19:06:05. 350: I/dalvikvm (3076): at Android. WebKit. webviewcore $ eventhub $1. handlemessage (webviewcore. Java: 1780)
07-07 19:06:05. 350: I/dalvikvm (3076): at Android. OS. handler. dispatchmessage (handler. Java: 99)
07-07 19:06:05. 350: I/dalvikvm (3076): at Android. OS. low.loop (low.java: 130)
07-07 19:06:05. 350: I/dalvikvm (3076): at Android. WebKit. webviewcore $ webcorethread. Run (webviewcore. Java: 750)
07-07 19:06:05. 350: I/dalvikvm (3076): At java. Lang. thread. Run (thread. Java: 1019)

07-07 19:06:05. 350: I/dalvikvm (3076): [<ffffffff>] 0 xffffffff

Recently, I was working on a project involving HTML5 and native interactions. The above log appears during the interaction process.

Prerequisites:

1. An activity has seven screens, each of which corresponds to one fragment, and each fragment corresponds to one webview.

2. This method is executed for every webview.

Mwebview. addjavascriptinterface (New nativehtml5 (getactivity (), "js2java_android ");

Symptom:

1. Click the content on the home page, and the page will return. The log is above.

Solution:

1. An activity only keeps one nativehtml5 object. That is, do not create a new JS interface for every fragment.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.