Running android emulator on nixos

I’m following the instructions here:

https://nixos.wiki/wiki/Android#Building_Android_on_NixOS

This is the shell.nix I’m using: https://gist.github.com/fctorial/9e6e6d4e1c48868e65e7368199b3cb88

This is the error I get when I try to run the emulator in this environment:

/mnt/DATA/Android/Sdk/emulator/qemu/linux-x86_64/qemu-system-i386: error while loading shared libraries: libplds4.so: cannot open shared object file: No such file or dire

ctory

Googling for libplds4 doesn’t give anything useful. How do I run android emulator on nixos? I installed it from AVD in android studio, which I didn’t install with nix.

I think you need to add nspr to your list.

1 Like

Yes that resolved the current issue but now I’m getting some more ‘library not found errors’. Can’t tell how many are there? I’ve added around 10 by now. Do you have a list of packages I will need to run the emulator?

This is the list of missing libraries in all binaries in emulator package directory: https://gist.github.com/fctorial/557479dfcde8def4b9365c7f3178c71e

Does cache.nixos.org provide a way to search which packages provide these libraries, similar to debian?

GitHub - nix-community/nix-index: Quickly locate nix packages with specific files [maintainers=@bennofs @figsoda @raitobezarius] can do that. Note that the index generation is still a little bit rough (it takes more resources than I would like).

1 Like

@bennofs Great. Btw how much ram does it consume? The nix-env instance it spawned is currently at 1.2 GB, and slowly increasing.

Also this script exists that plugs nix-index output into ldd output:

1 Like

Yeah, that’s what I meant by “more resources than I would like” :slight_smile: I haven’t measured it exactly, but I know I had troubles generating the index with less than 4G ram, while I works fine on my 8G laptop.

I don’t know who is maintaining the android package but ONLY if this is something they need to know- android needs a lot of work on NixOS, there’s a lot of trouble with licensing and libaapt2 et al.