1

Android で phonegap と raphael js を使用していくつかのパフォーマンス テストを実行しようとしていますが、アプリケーション logcat を実行しようとすると、次のエラーが表示されます。

03-20 19:52:15.095: D/CordovaLog(4208): Uncaught ReferenceError: Raphael が定義されていません 03-20 19:52:15.095: E/Web Console(4208): Uncaught ReferenceError: Raphael がファイルで定義されていません: ///android_asset/www/js/classes/bootstrapper.js:58

私のindex.htmlは次のようになります

    <!DOCTYPE html>
<!--
    Licensed to the Apache Software Foundation (ASF) under one
    or more contributor license agreements.  See the NOTICE file
    distributed with this work for additional information
    regarding copyright ownership.  The ASF licenses this file
    to you under the Apache License, Version 2.0 (the
    "License"); you may not use this file except in compliance
    with the License.  You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing,
    software distributed under the License is distributed on an
    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
     KIND, either express or implied.  See the License for the
    specific language governing permissions and limitations
    under the License.
-->
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <meta name="format-detection" content="telephone=no" />
        <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" />
        <title>Hello World</title>

        <script type="text/javascript" src="js/cordova/cordova-android-2.5.0.js"></script>
        <script type="text/javascript" src="js/libs/raphael-min.js"></script>
        <script type="text/javascript" src="js/libs/jquery-min.js"></script>
    </head>
    <body>
        <div class="app">
            <h1>Apache Cordova</h1>
            <div id="deviceready" class="blink">

                <p class="event listening"><a style="" href="informacoes.html">Ir para a p&aacute;gina de informa&ccedil;&otilde;es</a></p>
            </div>
        </div>     
        <script type="text/javascript" src="js/classes/bootstrapper.js"></script>


        <script type="text/javascript">

            app.testPeformance();
        </script>
    </body>
</html>

ブートストラップ.js

var app = {

        testPeformance : function () 

        {

            // Creates canvas 320 × 200 at 10, 50
            var paper = Raphael(0, 0, 320, 320);

            for (var i = 0; i < 500 ; i++ )
            {
                x = Math.floor( ( Math.random() *320) +1);
                y = Math.floor( ( Math.random() *320) +1);

                // Creates circle at x = 50, y = 40, with radius 10
                var circle = paper.circle(x, y, 30);
                // Sets the fill attribute of the circle to red (#f00)
                circle.attr("fill", "#f00");

                // Sets the stroke attribute of the circle to white
                circle.attr("stroke", "#fff");

            }

        }

}

IOS シミュレーターで完全に動作します。

前もって感謝します!

4

1 に答える 1

1

android が phonegap アプリケーションに使用する Web コンテナー (webkit) は、まだ SVG グラフィックスをサポートしていないようです (android 2.2)。

:(

于 2013-03-21T19:57:53.450 に答える