Andoridをエミュレータで今まで開発したことがなかったのですが、
Genymotionを使うと爆速と聞いたので使ってみました。流行に圧倒的に乗り遅れてますね。
わかったことをメモしていきます。
WebViewを使った時のローカルホストの指定
http://localhost では接続できません。
↓
http://192.168.56.1 こっちですね。
ti build(CLI)からgenymotionを選択する方法
genymotionを入れたからといって、エミュレータで勝手に「Genymotion」が立ち上がってくれるわけではありません。
こちらの記事では
titaniumを綺麗にして、ビルドして、adbコマンドで「Genymotion」に転送というやり方が紹介されていましたが、ti buildコマンドで転送できる方法をご紹介します。 また、buildのスクリプトを書き換える方法も紹介しています。
まだTitanium 3.1の頃の記事です。
$ titanium clean
$ titanium build --platform=android --build-only
$ adb -s 192.168.56.100:5555 install -r build/android/bin/app.apk
Titanium 3.2からGenymotionを一応サポートしているので、
少し便利に使えるようになりました。
こちらの記事をご参照してください。
http://www.appcelerator.com/blog/2013/12/using-genymotion-with-titanium-3-2/
エミュレータ設定&確認
設定
ti config genymotion.enabled true
確認
ti info -t android
Genymotionで追加した設定が出てきます。
Genymotion Emulators
Sony Xperia Tablet Z - 4.1.1 - API 16 - 1920x1200
SDK Version = 4.1.1
ABI = x86
Genymotion Version = 2.2.2
Display = 1920x1200-16
DPI = 320
OpenGL Acceleration = yes
Google APIs = unknown, emulator not running
Google Nexus 5 - 4.4.2 - API 19 - 1080x1920
SDK Version = 4.4.2 (android-19)
ABI = x86
Genymotion Version = 2.2.2
Display = 1080x1920-16
DPI = 480
OpenGL Acceleration = yes
Google APIs = unknown, emulator not running
ビルドコマンド
先ほど確認した「Genymotion Emulators」の名前を指定してあげることで、
Genymotionでビルドすることができます。
ti build -p android --device "Google Nexus 5 - 4.4.2 - API 19 - 1080x1920"
使ってみた感想
ぬるぬるですね。
ほんとにすごい。びっくりしました。
これからAndoridでわくわくエミュレータ開発ライフが待っていますね。