I cannot edit android emulator host file

I am trying to modify the android emulator host file. I follow the steps:

step1
adb root
step2
adb remount
step3
adb pull /system/etc/hosts .

Then I add a new line for client host information, then I click on the hosts file, I get some errors:

   step4
   adb push hosts /system/etc/hosts

error info:

adb: error: failed to copy 'hosts' to '/system/etc/hosts': couldn't create file: Read-only file system

event information:

   osx ei capitan  
   android emulator: android 7.1.1  
   android studio: 2.2.2  
+4
source share
4 answers

I ran into the same problem and made it work.

Run emulator:

emulator -avd <EMULATORNAME> -partition-size 512 -writable-system

I believe -writable-systemparam is what fixed it for me.

In another terminal prompt / cmd:

adb root

adb -s emulator-5554 remount

adb -s emulator-5554 pull /system/etc/hosts hosts

Now earn your magic (add the IP file to the host)

adb -s emulator-5554 push hosts /system/etc/hosts

Additional Information:

  • emulator-5554 - device name, you can find it using adb devices
  • The emulator program is inside android-sdk / tools
  • adb- android-sdk/platform-tools

:

, steven adb reboot adb root. AVD.

adb reboot , .

:)

+28

adb reboot, .

+2

, , , , .

(Android Studio win 10):

  • Android Studio AVD Manager Emulator.
  • powershell android sdk/platform/tools/
  • .\adb.exe reboot -writable-system ( )
  • .\adb.exe root
  • .\adb.exe remount
  • .\adb.exe pull /system/etc/hosts C:\Temp\hosts
  • hosts
  • .\adb.exe push C:\Temp\hosts /system/etc/hosts
  • .\adb.exe unroot
  • , , hosts.
  • , . " ...".
  • AVD Manager. hosts . .

, unroot. , , , , . .

0

, , adb root, : adbd root .

adb? , "su" adb, "not found"...

And, having no opportunity to name "root adb", I can not follow the excellent advice given above :( Any ideas on how to get out of this circle? Thanks!

-1
source

Source: https://habr.com/ru/post/1663724/


All Articles