yoshiweb.NET

Cordova ( PhoneGap ) で Androidアプリを作る for Mac

PhoneGapで Androidアプリをつくろうと思ったけどバージョンが違うのかPhoneGap Fanの手順でうまくできなかったので Cordovaを使いターミナルからコマンドでアプリ開発をする手順をまとめました。


※ 先にAndroid SDKをインストール&設定してください。
node.jsをインストールしてください。

1.ターミナルからcordovaをインストール
$ sudo npm install -g cordova

2.アプリのベース部分生成(プロジェクトを作成したいディレクトリで以下を実行)
$ cordova create hello com.example.hello HelloWorld

3.作成したアプリのディレクトリへ移動
$ cd hello

4.各プラットフォームの生成
$ cordova platform add android

5.アプリをビルド
$ cordova build android

6.エミュレーターで実行(Android)
$ cordova emulate android

7.実機で実行(USBで実機を接続してから)
$ cordova run android


※プロジェクトのディレクトリのパスにスペースなどが入ってるとビルド時にエラーがでました。
※ Android SDK ManagerでAndroid 4.2.2(API 17)をインストールする必要がありました。
  platforms/android/AndroidManifest.xml の android:targetSdkVersion を変更するのでもOKかもです。

Apache Cordova
http://cordova.apache.org/

Apache Cordova API Documentation
http://cordova.apache.org/docs/en/3.3.0/guide_cli_index.md.html


投稿日 : 2014年01月06日 - yoshiweb - カテゴリ: 雑記

コメント

投稿者 : выводим из запоя на дому

Have you ever thought about including a little bit more than just your articles?
I mean, what you say is fundamental and all.
Nevertheless think about if you added some great images or video clips to give your posts
more, "pop"! Your content is excellent but with images and clips, this website could certainly be
one of the very best in its niche. Very good blog!
2023年04月25日 03時06分32秒