jquery-mobile 加载到 android WebView 中

发布于 2024-11-03 12:38:22 字数 2863 浏览 1 评论 0原文

我无法将 jquerymobile 装饰的网页加载到 Android WebView 中。

考虑 jquery mobile 演示网站: http://jquerymobile.com/demos/1.0a4.1/< /a>

final WebView browser; 

browser = (WebView) findViewById(R.id.browser_webview);
final WebSettings settings = browser.getSettings();
settings.setJavaScriptEnabled(true);
settings.setAllowFileAccess(true);
settings.setBuiltInZoomControls(false);
settings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.SINGLE_COLUMN);
browser.loadUrl("http://jquerymobile.com/demos/1.0a4.1/);

部署到 Android 设备(nexus one)这只会崩溃。 部署到模拟器日志报告

INFO/HttpClientHelper(349): dispatch to 'http://jquerymobile.com/demos/1.0a4.1/'
INFO/ActivityManager(51): Displayed activity com.xxx.android/.presentation.activities.SomeActivity: 4194 ms (total 4194 ms)
DEBUG/dalvikvm(349): GC freed 3005 objects / 220168 bytes in 76ms

*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
Build fingerprint: 'generic/sdk/generic/:2.1-update1/ECLAIR/35983:eng/test-keys'
pid: 349, tid: 361  >>> com.retrieve.android <<<
signal 11 (SIGSEGV), fault addr 00000004
r0 004bf6f1  r1 00000014  r2 00000001  r3 004bf63c
r4 00000004  r5 004bf700  r6 00000000  r7 00000000
r8 4517ecf8  r9 426bdf1c  10 00000354  fp 426bdf18
ip ad080090  sp 4517d784  lr aa17a2c7  pc aa17e966  cpsr 00000030
#00  pc 0017e966  /system/lib/libwebcore.so
#01  lr aa17a2c7  /system/lib/libwebcore.so
code around pc:
aa17e954 e69eda00 f7ffa813 6f22fb91 b0216ea6
aa17e964 59a00094 1c27bdf0 683b378c 22019903
aa17e974 18471ad0 971b2000 2f00901a da009708
code around lr:
aa17a2b4 28004798 1c28d00f fad0f7c4 f0041c28
aa17a2c4 9b05f9b1 181f9903 29009705 1c28d00d
aa17a2d4 fc68f003 6828e009 680230ac 47901c28
stack:
4517d744  004bf7a0  [heap]
4517d748  0034a368  [heap]
4517d74c  aa17d36b  /system/lib/libwebcore.so
4517d750  00000000
4517d754  00000000
4517d758  004bf700  [heap]
4517d75c  004bf7a0  [heap]
4517d760  004bf700  [heap]
4517d764  00000000
4517d768  aa17cda5  /system/lib/libwebcore.so
4517d76c  aa17f2f9  /system/lib/libwebcore.so
4517d770  00000000
4517d774  00000000
4517d778  df002777
4517d77c  e3a070ad
4517d780  004bf63c  [heap]
#00 4517d784  004bf63c  [heap]
4517d788  004bf700  [heap]
4517d78c  00000000
4517d790  00000000
4517d794  aa17a2c7  /system/lib/libwebcore.so
4517d798  0030eb60  [heap]
4517d79c  00000000
4517d7a0  0034a368  [heap]
4517d7a4  00000000
4517d7a8  00000000
4517d7ac  00000000
4517d7b0  0030eb60  [heap]
4517d7b4  4517d898
4517d7b8  00000000
4517d7bc  004bf63c  [heap]
4517d7c0  00000000
4517d7c4  00000003
4517d7c8  0000024e

DEBUG/Zygote(29): Process 349 terminated by signal (11)
INFO/WindowManager(51): WIN DEATH: Window{43d2e3a8 com.xxx.android/com.xxx.android.presentation.activities.SActivity paused=false}

I've not been able to get a webpage decorated by jquerymobile to load into an Android WebView.

Consider the jquery mobile demo site: http://jquerymobile.com/demos/1.0a4.1/

final WebView browser; 

browser = (WebView) findViewById(R.id.browser_webview);
final WebSettings settings = browser.getSettings();
settings.setJavaScriptEnabled(true);
settings.setAllowFileAccess(true);
settings.setBuiltInZoomControls(false);
settings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.SINGLE_COLUMN);
browser.loadUrl("http://jquerymobile.com/demos/1.0a4.1/);

Deployed to an android device (nexus one) this just crashes.
Deployed to an emulator logs report

INFO/HttpClientHelper(349): dispatch to 'http://jquerymobile.com/demos/1.0a4.1/'
INFO/ActivityManager(51): Displayed activity com.xxx.android/.presentation.activities.SomeActivity: 4194 ms (total 4194 ms)
DEBUG/dalvikvm(349): GC freed 3005 objects / 220168 bytes in 76ms

*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
Build fingerprint: 'generic/sdk/generic/:2.1-update1/ECLAIR/35983:eng/test-keys'
pid: 349, tid: 361  >>> com.retrieve.android <<<
signal 11 (SIGSEGV), fault addr 00000004
r0 004bf6f1  r1 00000014  r2 00000001  r3 004bf63c
r4 00000004  r5 004bf700  r6 00000000  r7 00000000
r8 4517ecf8  r9 426bdf1c  10 00000354  fp 426bdf18
ip ad080090  sp 4517d784  lr aa17a2c7  pc aa17e966  cpsr 00000030
#00  pc 0017e966  /system/lib/libwebcore.so
#01  lr aa17a2c7  /system/lib/libwebcore.so
code around pc:
aa17e954 e69eda00 f7ffa813 6f22fb91 b0216ea6
aa17e964 59a00094 1c27bdf0 683b378c 22019903
aa17e974 18471ad0 971b2000 2f00901a da009708
code around lr:
aa17a2b4 28004798 1c28d00f fad0f7c4 f0041c28
aa17a2c4 9b05f9b1 181f9903 29009705 1c28d00d
aa17a2d4 fc68f003 6828e009 680230ac 47901c28
stack:
4517d744  004bf7a0  [heap]
4517d748  0034a368  [heap]
4517d74c  aa17d36b  /system/lib/libwebcore.so
4517d750  00000000
4517d754  00000000
4517d758  004bf700  [heap]
4517d75c  004bf7a0  [heap]
4517d760  004bf700  [heap]
4517d764  00000000
4517d768  aa17cda5  /system/lib/libwebcore.so
4517d76c  aa17f2f9  /system/lib/libwebcore.so
4517d770  00000000
4517d774  00000000
4517d778  df002777
4517d77c  e3a070ad
4517d780  004bf63c  [heap]
#00 4517d784  004bf63c  [heap]
4517d788  004bf700  [heap]
4517d78c  00000000
4517d790  00000000
4517d794  aa17a2c7  /system/lib/libwebcore.so
4517d798  0030eb60  [heap]
4517d79c  00000000
4517d7a0  0034a368  [heap]
4517d7a4  00000000
4517d7a8  00000000
4517d7ac  00000000
4517d7b0  0030eb60  [heap]
4517d7b4  4517d898
4517d7b8  00000000
4517d7bc  004bf63c  [heap]
4517d7c0  00000000
4517d7c4  00000003
4517d7c8  0000024e

DEBUG/Zygote(29): Process 349 terminated by signal (11)
INFO/WindowManager(51): WIN DEATH: Window{43d2e3a8 com.xxx.android/com.xxx.android.presentation.activities.SActivity paused=false}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

奢望 2024-11-10 12:38:22

通过将 jquery-1.5.2.min.js 替换为 jquery-1.5.2.js,我的大部分问题都消失了。

我的其余问题通过用绝对路径替换链接和脚本资源的相对路径得到解决。

Most all my issues went away by replacing jquery-1.5.2.min.js with jquery-1.5.2.js.

The rest of my issues were resolved by replacing relative paths to link and script resources with absolute paths.

三生池水覆流年 2024-11-10 12:38:22

为什么不查看负责加载其 Android Web 视图的 DroidGap 类的 PhoneGap 源文件?许多人经常使用 jquery mobile 以及其他框架,其中包括 android 上的phonegap。我相信您会在那里找到您想要的东西:

https://github.com/sintaxi/phonegap/blob/master/android/framework/src/com/phonegap/DroidGap.java

Why not check out the phonegap source file for the DroidGap class responsible for loading its Android web view? Many people are routinely using jquery mobile, among other frameworks, with phonegap on android. I'm sure you'll find what you're looking for in there:

https://github.com/sintaxi/phonegap/blob/master/android/framework/src/com/phonegap/DroidGap.java

一杯敬自由 2024-11-10 12:38:22

要查看 PhoneGap 加载 jQuery Mobile 演示站点的示例,请查看 http:// www.mobiledevelopersolutions.com/home/start/included-demo-apps

To see an example of PhoneGap loading the jQuery Mobile demo site, check out http://www.mobiledevelopersolutions.com/home/start/included-demo-apps

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文