Showing posts with label adb. Show all posts
Showing posts with label adb. Show all posts
Monday, March 19, 2018
Thursday, February 1, 2018
Tuesday, June 24, 2014
Friday, May 31, 2013
Android Studioでエミュレータのhosts変更
開発等でエミュレータのhostsを書き換えたいとき
を開き
[Emulator]タブを選択
[Additional command line options]にチェックを入れ
-partition-size 512
と入力
(他のサイトを参照すると128でも良さそうだったのだが、上手くいかなかったため512を設定)
[OK]を押して終了
エミュレータを普通にRunして、remount(エミュレータの /system 以下を読み書き可にする)
error: device offline
→ デバイスがConnectされてない、もう一度Runしてみる
error: more than one device and emulator
→ 2台以上のデバイス&エミュレータがConnectされているので1つにする
エミュレータのhostsを取得(必要なら)
エミュレータのhostsを置き換える
failed to copy '/Users/xxxxxxx/hosts' to '/system/etc/hosts': Out of memory
エミュレータのhostsを確認
remount, pushはエミュレータ起動時に毎回行う必要がある
参考
エミュレータの起動オプションを追加設定
[Run]→[Edit Configurations...]を開き
[Emulator]タブを選択
[Additional command line options]にチェックを入れ
-partition-size 512
と入力
(他のサイトを参照すると128でも良さそうだったのだが、上手くいかなかったため512を設定)
[OK]を押して終了
エミュレータ内のhosts書き換え
あらかじめadbのpathを通しておく$ export PATH=$PATH:/Applications/Android\ Studio.app/sdk/platform-tools
エミュレータを普通にRunして、remount(エミュレータの /system 以下を読み書き可にする)
$ adb remountこのときエラーが出る場合がある
error: device offline
→ デバイスがConnectされてない、もう一度Runしてみる
error: more than one device and emulator
→ 2台以上のデバイス&エミュレータがConnectされているので1つにする
エミュレータのhostsを取得(必要なら)
$ adb pull /system/etc/hosts ~/hosts
エミュレータのhostsを置き換える
$ adb push ~/hosts /system/etc/hosts上記の起動オプションを設定しなかった場合、ここで以下のエラーが出てしまう
failed to copy '/Users/xxxxxxx/hosts' to '/system/etc/hosts': Out of memory
エミュレータのhostsを確認
$ adb shell $ cat /System/etc/hosts
remount, pushはエミュレータ起動時に毎回行う必要がある
参考
Subscribe to:
Posts (Atom)