4

I used to start my Android Studio emulator using

emulator -avd "mydevice" -writable-system

But suddenly now it only works if I remove the -writable-system option, otherwise it is stuck with the boot logo.

Why would that option change the outcome of booting?

And how can I understand what happened, in order to fix this and make the -writable-system option work again?

In the worst case, is there a way to reset the system image without erasing the user data?

Kubuntuer82
  • 1,487
  • 3
  • 18
  • 40

1 Answers1

11

At the end I solved the problem by myself...

The cause of the problem was a corrupted system partition.

I went in my AVD folder and renamed system image file system.img.qcow2 into BACKUP_system.img.qcow2 (I could also have deleted it, but you never know).

Then, once I ran the emulator with option -writable-system, since it could not find the system image file anymore, then it created a new one and now it is possible to write on the system partition again.

And this also allowed me to avoid erasing the user data partition, therefore I saved the data and it's like nothing bad ever happened.

The reason why it was still working without the -writable-system option:

When I removed the system.img.qcow2 file, initially I tried to run the emulator without the -writable-system. Again, it worked... and no new system image file was generated.

I tried to investigate on this, and when running:

emulator -help-disk-images

I noticed it says:

If you use a virtual device, its content directory should store
all writable images, and read-only ones will be found from the
corresponding platform/add-on directories.

So this is why the emulator was still working without the -writable-system option, although the system image file was corrupted. It's because that was a writable image file, so it's not loaded if the -writable-system option is not used, and the read-only system image, which is stored in a different place, is loaded instead.

And of course, when the emulator needs to create a new writable system partition (like in this case), it copies it from that read-only system image.

Kubuntuer82
  • 1,487
  • 3
  • 18
  • 40