9

Ripple を使用してブラウザで PhoneGap アプリをテストする適切な方法は何ですか? 必要な設定はありますか?

PhoneGap で作成された "hello world" アプリがあり、変更ごとに電話エミュレーターを起動するのではなく、ブラウザーでテストしたいと考えています。ローカル Web サーバーで実行しています。http://emulate.phonegap.comを使用してアドレス (例: localhost:8888/sites/hello/www) にアクセスしました。アプリの読み込みが開始されますが、 の 404 が表示されphonegap.jsます。チェックしているパスは次のとおりですlocalhost:8888/sites/hello/www/phonegap.js-これはエミュレーターによって提供される必要がありますか? ファイルを掘り起こす必要がありますか? 私は在庫の hello world アプリを使用しているので、ピースが配置されていることを期待していました。

4

4 に答える 4

14

Ripple が機能するには phonegap.js を提供する必要があります。index.html にスクリプト タグを挿入して<head>、それを指すようにするだけです。Ripple は Phonegap 3.x では正しく動作しないことに注意してください。そのため、Phonegap 2.x リリースの JS を使用してください。私は Android パッケージの cordova-2.9.0.js を使用しています。リップルは Google Chrome でのみ動作します。

ちなみに、Chrome を起動するときにオプションを使用すると、ローカル Web サーバーを必要とせずに、ファイルシステムから Chrome で index.html ファイルを直接開くことができます--allow-file-access-from-files。たとえば、ショートカットに追加するだけです。"C:\Program Files\Google\Chrome\Application\chrome.exe" --allow-file-access-from-files

于 2013-11-03T18:45:40.813 に答える
8

Important: uninstall ripple Chrome-Addon first!!

Solution 1: 'patch it!'

To test your phonegap3 applications in ripple you have to use the latest version (0.9.19) from the apache git repository and patch it with the ripple_phonegap3.patch located at this git-repo. Follow the instructions in the README.md file located in the same repository.

The new version of ripple is not longer a chrome extension. It's now a nodejs/expressjs webserver to support other browsers as well.

Solution 2: 'step-by-step' (only when you use phonegap3 exclusively)

  • Download ripple

    git clone https://git-wip-us.apache.org/repos/asf/incubator-ripple.git
    
  • Edit lib/server/emulate/hosted.js

Add lines

    var PG3_SCRIPTTAG_OLD= /<script type="text\/javascript" src="phonegap.js"><\/script>/;
    var PG3_SCRIPTTAG_NEW= '<script type="text/javascript" src="cordova.js"></script>';
    doc = doc.replace(PG3_SCRIPTTAG_OLD, PG3_SCRIPTTAG_NEW);

in function localInjection() between

        var doc = data.replace(HEAD_TAG,
                  '<head>' +
                    '<script>' +
                        BOOTSTRAP_FROM_IFRAME +
                    '</script>');

and

        res.send(doc);
  • run ./configure
  • run jake
  • use bin/riddle

lg

fastrde

于 2013-11-08T13:50:17.590 に答える
1

Icenium には無料の試用版があり、とても素晴らしいです: http://www.icenium.com/

于 2013-11-10T05:53:52.883 に答える