Monday, October 16, 2017

AVDs not starting with hardware emulation for graphics

Okay, so with hardware emulation enabled for graphics, I ran into another issue where an AVD would not launch at all. The progress bar on the bottom would say Starting AVD and it would complete that, but no virtual device is launched or any error given.

The problem it turns out is that the AVD loads an incorrect version of libstdc++. To fix that remove the SDK version of libstdc++ so it is forced to use the system provided lib. You can do that as follow:


rm -r /PATH_TO_SDK/Sdk/emulator/lib64/libstdc++


Emulated performance greyed out in AVD device configuration

So, there is an emulated performance section where you can toggle the emulation mode for graphics between automatic, software or hardware. However, I was creating a new virtual device and wanted to do hardware emulation but this section was completely greyed out with value set to automatic.

After some looking around it seems that it only happens with devices that have got Play Store available. And sure enough, my Nexus 5X did have. So to get around it and to be able to change graphics emulation mode, you need a device that does not have Play Store. I got it working with Nexus 4!

Android Studio: No space left on device

I have run into this problem on two instances:
  1. While performing installation, updates of SDK or new system images.

    This means your tmpfs does not have enough capacity. But you can't just flush contents of your /tmp to free space since the installation data is downloaded there. You can either disable tmpfs or mount tmp to /var/tmp/ by adding this line to the top of studio.sh:
    export _JAVA_OPTIONS=-Djava.io.tmpdir=/var/tmp
  2. Android Virtual Device (AVD) fails to start giving this particular error. You can just go ahead and clear everything in your /tmp with something like sudo rm -rf /tmp/*

AVDs not starting with hardware emulation for graphics

Okay, so with hardware emulation enabled for graphics, I ran into another issue where an AVD would not launch at all. The progress bar on t...