问题:

The javascript to java bridge on 2.3 Gingerbread is causing crashes.  This is 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 that 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 these interfaces have been deprecated.It is also easily reproducible by creating a simple application that creates a webview, enables javascript, adds a JS interface, then loads a script into the webview. The code for this even simpler app is attached as well as WebViewTest and a secondary Test class as the "bridge".The demos work as expected when using 2.2This is a serious issue as it will 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
解决方案:
安卓2.3中会有问题,换个target版本启动即可解决。
参考:
https://code.google.com/p/android/issues/detail?id=12987

转载于:https://www.cnblogs.com/webapplee/p/3771909.html

[Android]Webview中JS接口调用Java-版本问题相关推荐

  1. Xamarin Android Webview中JS调用App中的C#方法

    参考链接:https://github.com/xamarin/recipes/tree/master/Recipes/android/controls/webview/call_csharp_fro ...

  2. android开发接口调用,Android开发中webService接口调用示例

    代码示例: package com.study.ws; import java.io.IOException; import org.ksoap2.SoapEnvelope; import org.k ...

  3. android WebView中js的alert()失效

    WebView的设置代码 wv = (WebView) findViewById(R.id.webView1); wv.getSettings().setJavaScriptEnabled(true) ...

  4. JavaFX下的WebView中js调用java注入方法提示undefined?

    关键词: java注入无效 js无法调用java方法 java上下文注入未生效 背景: 官方提供的demo是直接new JavaApp(),但实际使用不行,需要刷新页面后才生效 解决方案: 主要修改的 ...

  5. android webview调js方法,Android中WebView与H5的交互,Native与JS方法互调

    项目中经常用到WebView与H5的交互,一个是H5调本地方法,一个是本地调H5方法,在此记录一下. 首先,启用JS支持 //启用js支持 webSettings.setJavaScriptEnabl ...

  6. android webview中h5调用 拍照/相册 通用支持代码

    android webview中h5调用 拍照/相册 通用支持代码. 在webview的   WebChromeClient 中,重写 // For Android >= 5.0 @Overri ...

  7. Android与H5相互接口调用及Android端接口整理

    近几年随着HTML5的功能越来越强大,H5页面的性能虽然稍差,单其灵活性很高,更新页面成本比原生小很多,一个页面可以被android和ios同时使用开发成本也比较低,所以移动端的开发已经不是单单的原生 ...

  8. (HarmonyOS)JS FA调用Java PA(一)Ability概念及Ability与Internal Ability调用方式

    JS FA调用Java PA(一)Ability概念及Ability与Internal Ability调用方式 引言 Ability FA-Page Ability PA-Service Abilit ...

  9. android webview 支持ajax,Ajax在android webview中不起作用

    我正在webview中加载一个网站,我们在网站上使用了Ajax,它在网页浏览器和移动浏览器上也运行良好,但在android webview中ajax无法正常工作,控制台中没有错误.这是我的代码: – ...

  10. android webview打印,javascript - 如何在Android Webview中使网站上的打印按钮工作? - 堆栈内存溢出...

    我的网站上有一个模式按钮,在该按钮上附加了一个处理程序函数以打印模式. 该处理程序具有处理"仅打印模式"的代码,并最终运行window.print(). 该按钮的功能类似于浏览器中 ...

最新文章

  1. Winform开发框架重构总结
  2. IP包的生成和发送接口(1)
  3. R 指定安装镜像的方法
  4. amqp rabbitmq_Spring AMQP RabbitMQ示例
  5. Ubuntu-vim 命令
  6. 机器学习--digits手写字体
  7. Java基础学习教程,eclipse简单使用教程(Java集成开发工具)
  8. android cocos 二次启动 崩溃,基于cocos2dx 1.0.1 0.12.0的第二次运行时android...
  9. 螳螂科技产研分享:做有生命力的SaaS产品架构
  10. java中竖线怎么画_java split | (竖线)
  11. 误删代码,回收站又被清空还没有备份教你如何解决
  12. 纪实之2013年秋,我在找工作
  13. VIJOS-P1232核电站问题
  14. 配置tomcat使用https方式连接,同时也可以使用http方式连接
  15. Dynamic Programming?老牛吃药
  16. 【Python-OpenCV 人物素描】
  17. 根据三角形的三条边长,判断三角形
  18. 日历按钮html,简易日历的html
  19. ChatGPT大流行的思考-设想篇
  20. 【动态规划】0-1背包递推式的剖析(通俗易懂)

热门文章

  1. Intel® Math Kernel Library (Intel® MKL)
  2. [USACO12FEB]附近的牛Nearby Cows
  3. go tour - Go 入门实验教程
  4. OC typedef(起别名)
  5. 序列化和反序列化的概念
  6. MyBatis的动态SQL详解nbsp;(转载)
  7. 什么是互联网思维?给你最全面的解释
  8. 第四次课后作业及Sring类型的应用
  9. iOS 关于修饰代理用weak还是assign
  10. 关于软件测试里面的Fault Error Failure 差别