首页 文章

POLYMER:无法在Android设备中查看聚合物元素

提问于
浏览
1

我试图通过使用聚合物(0.5)制作的phonegap(3.7)(build.phonegap.com)构建一个示例应用程序 . 构建成功 .

但是,当我在我的android(v4.4)设备中安装应用程序时,我看不到聚合物元素(我刚刚插入 <paper-checkbox> 进行测试) . 所有其他简单的HTML元素都正常呈现 .

我读到了关于HTML webview对HTML导入的支持,所以我试图硫化index.html,但它没有在浏览器的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

  • 钩子

  • 平台

  • 插件

  • www

  • config.xml

  • css

  • icon.png

  • img

  • index.html

  • js

  • index.js

  • res

  • bower_components

  • 聚合物

  • webcomponentsjs

  • 图标

  • 屏幕

  • spec

  • spec.html


有什么我想念的吗?请帮忙 . 谢谢!

此致,Soumya

1 回答

  • 0

    我在一个在github中使用Polymer的库中看到了这个issue . 它表示它不支持Android 4.4以下的设备(可能) . 我正在尝试与Cordova Crosswalk整合,看看我是否可以让它发挥作用 . 4.4之前的Android版本的浏览器非常糟糕 . 我真的很难让我的网络应用程序在低端设备上运行 .

    一些问题,比如非常慢的js性能,异常,错误在旧的webview上猖獗 . 我们现在可以做的是使用不同的webview包装我们的应用程序,例如使用Cordova和Crosswalk,我也从上面提供的链接中提出建议 .

    希望这可以帮助 .

相关问题