LoginSignup
0
0

More than 5 years have passed since last update.

Androidのエミュレーターのhostsを書き換えてみた

Posted at

Vagrant+VirtualBox 環境で、hostsを書き換えて開発環境を作っています。
AndroidのエミュレーターからゲストOSにアクセスをしたい場合、Android側のhostsを書き換える必要があると思います。

以下のようにやったらできました。

$ adb pull /system/etc/hosts ./hosts
0 KB/s (25 bytes in 0.041s)
$ ls
hosts
$ vi hosts //ゲストOSのIP追加など
$ adb shell
# cat /system/etc/hosts
127.0.0.1           localhost
# su
# mount -o rw,remount -t yaffs2 /dev/block/mtdblock2 /system
# exit
# exit
$ adb push hosts /system/etc/hosts
1 KB/s (224 bytes in 0.130s)
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0