m_shige1979のときどきITブログ

プログラムの勉強をしながら学習したことや経験したことをぼそぼそと書いていきます

Github(変なおっさんの顔でるので気をつけてね)

https://github.com/mshige1979

Cordovaをインストールしてみる

cordovaをインストール

npmよりcordovaをインストール
npm install cordova -g
android sdkのパスを設定
export PATH="$PATH:/Applications/android-sdks/tools/"
export PATH="$PATH:/Applications/android-sdks/platform-tools/"
設定ファイル読み込み
source ~/.bash_profile
確認
$ android -h

       Usage:
       android [global options] action [action options]
       Global options:
  -s --silent     : Silent mode, shows errors only.
  -v --verbose    : Verbose mode, shows errors, warnings and all messages.
     --clear-cache: Clear the SDK Manager repository manifest cache.
  -h --help       : Help on a specific command.

                                                                    Valid
                                                                    actions
                                                                    are
                                                                    composed
                                                                    of a verb
                                                                    and an
                                                                    optional

プロジェクトの作成

任意のディレクトリを作成してそこへプロジェクトを作成
cd sample_projects/
cordova create hello com.example.hello HelloWorld -d
ディレクトリへ移動
cd hello/
cordova platform add android

失敗する場合は以下を実行

brew update
brew install ant
確認
 ls platforms/android/
AndroidManifest.xml	cordova			platform_www		src
CordovaLib		custom_rules.xml	proguard-project.txt
assets			libs			project.properties
build.xml		local.properties	res
$

eclipseへ設定

インポート

f:id:m_shige1979:20140623225736p:plain
ワークスペースへのコピーではなくその場所を使用する

確認

f:id:m_shige1979:20140623230038p:plain

実行

f:id:m_shige1979:20140623230355p:plain

まとめ

html形式で作成できるらしいのでちょっとhtmlを作成したものを適用して確認してみる。
javaでのコーディングは不慣れなので簡単な感じのものから扱ってみる。