Running the android emulator from the command line

So the android emulator works fine through android-studio, but it’s a bit annoying to have to open android-studio every time I want to launch the emulator so I want to open it from the CLI, but for some reason running the emulator command gives this error

Failed to execute process '/home/skykanin/Android/Sdk/emulator/emulator'. Reason:
The file '/home/skykanin/Android/Sdk/emulator/emulator' does not exist or could not be executed.

So I looked around on the forums and nixpkgs manual and found this So I wrote this nix file to run an android emulator

with import <nixpkgs> {};

androidenv.emulateApp {
  name = "Pixel_4_API_29";
  platformVersion = "29";
  abiVersion = "x86";
  enableGPU = true;
  avdHomeDir = "/home/skykanin/.android/avd";
  systemImageType = "google_apis";

created an AVD instance that matched the android sdk version of my emu.nix file (29) through android studio and ran nix-build emu.nix && ./result/bin/run-test-emulator, but I get this error

Looking for a free TCP port in range 5554-5584
We have a free TCP port: 5554
Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/bind/annotation/XmlSchema
Caused by: java.lang.ClassNotFoundException: javax.xml.bind.annotation.XmlSchema
	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(
	at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(
	at java.base/java.lang.ClassLoader.loadClass(
	... 5 more

So I’m not sure exactly how one can run the emulator from the command line