Android Studio 3.0 on Arch Linux, Gnome 3 and Wayland

I did a lot of Android programming during recent years with Java (and some C++). Since Kotlin seemed to be a hype on this years Google I/O I want see what the fuzz is all about. So why not check out the upcoming Android Studio 3.0 at the same time? In addition to the Kotlin integration (which was previously available as plugin) I am also interested in the improved profiling tools.

After downloading AS one of the first things I tried was to created an AVD with Android 7.1.1 on x86_64, KVM enabled with host GPU rendering. Creating the AVD went fine, but it would not start. What the heck?

First I thought this was related to Wayland and not running X11 but after searching online I found that other people also had the same issue. Android Studio comes its own libraries and the libstdc++ seems to be not compatible with the graphics driver. The solution I found to be working is to use -use-system-libs as parameter for the emulator on the command line. Since I do not want to start the emulator from the command line I investigated further and found that adding the following line into the .bashrc would also allow me to start the emulator by pressing the run button in Android Studio.

export ANDROID_EMULATOR_USE_SYSTEM_LIBS=1

Ok, first problem solved.

Then I ran into another issue which at first I thought was related to Kotlin. I started a new project that should use Kotlin. After finishing the setup wizard I had a shiny new “Hello World” project using Kotlin. But Android Studio kept complaining about errors in a generated intermediate values.xml. The problem here seems to be the locale I use on my system. In Germany (de_DE.UTF-8) we use the comma to separate the decimal places whereas in the US (en_US.UTF-8) the decimal point is used. The generated files contained decimal points for floating point value dimensions and Android Studio would check that against the locale and expected commas. To work around this people suggest to change the value of LC_NUMERIC to a locale that uses decimal points which I did not like since I do not want to change the locale settings system wide. So someone suggested to modify the Android Studio startup script (studio.sh) and add an LC_NUMERIC override in there which I did at the beginning of the file.

LC_NUMERIC="en_US.UTF-8"

Second problem solved. Kotlin “Hello World” can now be build and run on the emulator. After all the problems I had were not related to Gnome or Wayland.

Arch Linux on Dell XPS 13 9360

I recently installed Arch Linux on my new Dell XPS 13 (9360). Since I favor Linux over other operating systems and I ordered the XPS with Ubuntu 16.04 pre-installed. I must say that Canonical and Dell did quite a decent job on the Linux support and if someone is looking for a Linux laptop I would say go ahead and order it. I also hope that Dell and Caninical keep up the good work and extend their Linux support to more systems. My main focus is software development (OpenGL, Vulkan, Android, Java, C++) and of course browsing websites and reading mails.

Although Ubuntu 16.04 is fine I wanted to run a distro with up-to-date kernel (4.11, NVME power saving) and software packages (Arch) so I wiped the disk, created an encrypted LVM spanning the whole disk (except for the EFI partition) with a root, home and swap partition on top. The boot directory is also encrypted as part of the root partition. The setup works like a charm. I decided to use Gnome 3.24 along with Wayland as my desktop environment. Power consumption can be tweaked and depending on current usage the Gnome battery indicator states that the system can be used for about 12:30 h. I would take this with a grain of salt though, I did not run tests on it and the value is not quite stable (decreases and then goes back up again). The first impression is quite good.

One thing that surprised me was the sound. It was far better than I expected and even seems to be independent of the angle from the device to my ears.

This post started off as a description on how to get Android Studio working but turned out to be a rather rough description of the setup. More on Android in another post.