【发布时间】:2015-07-10 17:56:04
【问题描述】:
我试图通过使用聚合物 (0.5) 制作的 phonegap(3.7)(build.phonegap.com) 构建示例应用程序。构建成功。
但是,当我在我的 android(v4.4+) 设备中安装该应用程序时,我看不到聚合物元素(我只是插入了一个 <paper-checkbox> 进行测试)。所有其他简单的 HTML 元素都正常呈现。
我阅读了有关 HTML 导入的 android webview 支持,因此我尝试对 index.html 进行硫化,但没有帮助。但是我可以通过在我的笔记本电脑上运行 python SimpleHTTPServer 来看到聚合物元素,并且浏览器 javascript 控制台中没有错误(failed to load resource.. cordova.js 除外)。
这是我创建的 index.html(非硫化版本):
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="format-detection" content="telephone=no" />
<meta name="msapplication-tap-highlight" content="no" />
<!-- WARNING: for iOS 7, remove the width=device-width and height=device-height attributes. See https://issues.apache.org/jira/browse/CB-4323 -->
<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height, target-densitydpi=device-dpi" />
<link rel="stylesheet" type="text/css" href="css/index.css" />
<link rel="import" href="res/bower_components/paper-checkbox/paper-checkbox.html">
<script type="text/javascript" src="res/bower_components/webcomponentsjs/webcomponents.js"></script>
<script type="text/javascript" src="cordova.js"></script>
<script type="text/javascript" src="js/index.js"></script>
</head>
<body>
<div class="app">
<h1>PhoneGap</h1>
<div id="deviceready" class="blink">
<h3>POLYMER!</h3>
</div>
<br>
<p>Introducing Polymer element next...</p>
<hr>
<paper-checkbox></paper-checkbox> This is a polymer checkbox
<hr>
</div>
<script type="text/javascript">
app.initialize();
</script>
</body>
这里是项目的目录结构
- config.xml
- 挂钩
- 平台
- 插件
- 万维网
- config.xml
- CSS
- icon.png
- img
- index.html
- js
- index.js
- 资源
- bower_components
- 聚合物
- webcomponentsjs
- 图标
- 屏幕
- bower_components
- 规格
- spec.html
有什么我想念的吗?请帮忙。谢谢!
问候, 苏米亚
【问题讨论】:
-
我应朋友 Oswald Campesato 的要求尝试了 Polymer。那没起效。他是Web Components Meetup group in Silicon Valley 的成员。您也许可以向他们寻求帮助。
-
谢谢 JesseMonroy650,我会尽量联系他们。
-
我相信这是因为使用旧浏览器的设备上的聚合物不兼容。 Android 使用其旧的原生浏览器来显示我们的 phonegap 项目。不幸的是,它不支持 dom API 等提供的最新技术。
标签: android html cordova phonegap-build polymer-1.0