LoginSignup
7
8

More than 5 years have passed since last update.

Android Emulatorのhostsを書き換える方法

Last updated at Posted at 2017-08-02

昨今Android Emulatorでhostsを書き換える手順メモ。

まず emulator を -writable-system で立ち上げる。これをやらないとこのあとに出て来るコマンドをいくら叩いてもできない。 emulator は android sdk内に入っている。

emulator -writable-system -netdelay none -netspeed full -avd Nexus_6_API_23

次にどのデバイスでsystemが使用されているのか確認。

cat /proc/mounts

自分の場合は下記のようになってた。 /dev/block/vda がデバイス。

:
/dev/block/vda /system ext4 ro,seclabel,relatime,data=ordered 0 0
:

最後にmountコマンドを実行

mount -o rw,remount -t ext4 /dev/block/vda /system

これで hostsファイルの書き換え準備が整った。

あとはhostsファイルを書き換えるだけ。

adb push (書き換えたhostsファイル)hosts /system/etc/hosts
7
8
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
7
8