使用Google Maps API构建应用错误

时间:2012-12-09 20:15:53

标签: build sencha-touch-2

我有一个问题是使用此命令构建我的sencha touch 2应用程序:“sencha app build production”。我看到以下问题:

C:\xampp\htdocs\eiamobile\eiamobile\i>sencha app build production
[INFO] Deploying your application to C:\xampp\htdocs\eiamobile\eiamobile\i\build\production
[INFO] Copied sdk/sencha-touch.js
[INFO] Copied app.js
[ERROR] UNKNOWN, unknown error 'C:\xampp\htdocs\eiamobile\eiamobile\i\build\production\http:'

如果我在app.json文件中使用外部JS(谷歌几何)文件,我只会看到:

  "js": [
    {
        "path": "sdk/sencha-touch.js"
    },
    {
        "path": "app.js",
        "bundle": true,  /* Indicates that all class dependencies are concatenated into this file when build */
        "update": "delta"
    },
    {
        "path": "http://maps.google.com/maps/api/js?sensor=false&v=3&libraries=geometry",
        "bundle": true,  /* Indicates that all class dependencies are concatenated into this file when build */
        "update": "delta"
    }

]

任何帮助将不胜感激

编辑:

添加我的index.html文件

 <html manifest="" lang="en-US">
 <head>
 <meta charset="UTF-8">
 <title>eia-sencha</title>
 <style type="text/css">
     /**
     * Example of an initial loading indicator.
     * It is recommended to keep this as minimal as possible to provide instant feedback
     * while other resources are still being loaded for the first time
     */
    html, body {
        height: 100%;
        background-color: #1985D0
    }

    #appLoadingIndicator {
        position: absolute;
        top: 50%;
        margin-top: -15px;
        text-align: center;
        width: 100%;
        height: 30px;
        -webkit-animation-name: appLoadingIndicator;
        -webkit-animation-duration: 0.5s;
        -webkit-animation-iteration-count: infinite;
        -webkit-animation-direction: linear;
    }

    #appLoadingIndicator > * {
        background-color: #FFFFFF;
        display: inline-block;
        height: 30px;
        -webkit-border-radius: 15px;
        margin: 0 5px;
        width: 30px;
        opacity: 0.8;
    }

    @-webkit-keyframes appLoadingIndicator{
        0% {
            opacity: 0.8
        }
        50% {
            opacity: 0
        }
        100% {
            opacity: 0.8
        }
    }
 </style>
 <!-- The line below must be kept intact for Sencha Command to build your application -->
<script id="microloader" type="text/javascript" src="sdk/microloader/development.js"></script>
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false&v=3&libraries=geometry"></script>

 </head>
 <body>
   <div id="appLoadingIndicator">
    <div></div>
    <div></div>
    <div></div>
   </div>
 </body>
 </html>

2 个答案:

答案 0 :(得分:2)

答案 1 :(得分:2)

From Sencha Touch documentation

要使用此组件,您必须包含Google提供的其他JavaScript文件:

<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=true"></script>

所以,我猜你可以尝试以这种方式加载API,这实际上就是他们在框架附带的地图示例中的做法。

此外,如果您的应用启动时谷歌未定义,我猜您可以异步加载GM API:

http://www.senchafiddle.com/#MhAME

希望这有帮助