created: 2020-01-17T06:47:02.000Z

androidの仮想デバイス(AVD)にadb rootで接続する

androidの /data/ 配下など、rootでしかアクセスできない領域のデータを確認する場合に、 adb root する必要がある

仮想デバイスの起動

# 一覧を取得
$ emulator -list-avds
# 起動
$ emulator -avd GoogleAPI_-_Pixel_2_XL_API_29

接続

注意

OSイメージによってadb rootできないものがある 仮想デバイスを作成するときに Google Play ~ というのを選ぶとrootできない

To enable root access, use an emulator image like Google APIs Intel x86 Atom System Image not Google Play Intel x86 Atom System Image

接続

adbコマンドで接続する

$ adb root
restarting adbd as root
$ adb shell
1|generic_x86:/ # ls -lah /data/user/
total 8.0K
drwx--x--x  2 system system 4.0K 2020-01-17 15:29 .
drwxrwx--x 45 system system 4.0K 2020-01-17 15:29 ..
lrwxrwxrwx  1 root   root     10 2020-01-17 15:29 0 -> /data/data

参考

不道徳な経済学: 転売屋は社会に役立つ (ハヤカワ文庫NF)
[ad] 不道徳な経済学: 転売屋は社会に役立つ (ハヤカワ文庫NF)
ウォルター ブロック, 橘 玲 (文庫)