8
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

Androidエミュレーターの新しいデバイスで hosts が read onlyで編集できない場合の回避方法

Posted at

はじめに

開発環境をエミュレーターから確認するにあたり hosts を書き換えるようとして Read-only file system が発生し困ったので解決策を備忘録として記載しておく
hosts の書き換え手順に関しては他の記事があるのでそちらにお任せします

Read-only file system エラーの対応

adb pusherror: failed to copy 'hosts' to '/system/etc/hosts': remote couldn't create file: Read-only file system で失敗する場合の解決策としてadb root を行う方法が紹介されていますが新しいデバイスで動作しません
古いデバイスをインストールすることでも回避することは可能ですができればAndroid 4.4 以降のデバイスでやりたい

disable-verity を使用して dm-verity を無効にすることで解決しました
自分は Android は詳しくないので dm-verity に関しては下記の記事を参照ください

$ adb root
$ adb disable-verity
$ adb reboot
$ adb root
$ adb remount
$ adb push ~/hosts /system/etc/hosts
8
2
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
8
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?