[Android] WebView in JS interface call java-version issue

Source: Internet
Author: User

Problem:

The JavaScript to Java Bridge on2.3 Gingerbread is causing crashes. This was 100% reproducible using the Webviewdemo application from here:http://code.google.com/p/apps-for-android/source/ browse/#svn/trunk/samples/webviewdemo.note:the project file for this app is a little messed up, however, if you recreate  The project, keeping the code the same, you can reproduce the error. The sample is old, but the code should still run as none of the these interfaces has been deprecated. It is also easily reproducible by creating a simple application that creates a WebView, enables JavaScript, adds a JS inte Rface, then loads a script into the webview. The code for this even simpler app was attached as well as webviewtest and a secondary Test class as the "bridge".  The demos work as expected if using 2.2This is a serious issue as it would cause crashes for any app using the WebView to  Do any serious work. Thanks in advance for taking a look at this. Attached is the output from Logcat as well as the output from ADB bugreport.
Log.txt
8.3 KB View Download
Bug.txt
1.1 MB View Download
Webviewtest.java
764 bytes View Download
Test.java
149 bytes View Download
Solution:There will be a problem with Android 2.3, which can be solved by changing the target version. Reference:https://code.google.com/p/android/issues/detail?id=12987

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.