Fail to create devices in Android Studio

Hi everybody!
have developed for Android some time ago, but this is the first time attempting in NixOs.

Tried to follow different instructions found online (with varying success…)

The one with best success so far:

x flake init -t github:tadfisher/android-nixpkgs
nix develop
android-studio    # available on x86_64-linux platforms

Following the tip from Android Studio with nixpkgs-provided SDK does not work · Issue #355045 · NixOS/nixpkgs · GitHub I am now able to :

  • Start android Studio
  • Start Device Manager
  • Start creating a virtual device
  • Select device HW
  • All the Images are greyed out - needs to be downloaded…
    Here is the problem: SDK Component installer tries to download to read only SDK directory


env | grep ANDR
ANDROID_HOME=/nix/store/gcly4m5aygv647gj26mx1ld2j0c1mr5k-android-sdk-env/share/android-sdk
ANDROID_SDK_ROOT=/nix/store/gcly4m5aygv647gj26mx1ld2j0c1mr5k-android-sdk-env/share/android-sdk

I always use androidStudioPackages.stable from nixpkgs. No special flake.
The headless emulator works, I haven’t tried the “proper” emulator yet.

Tried the headless a couple of different ways:
This is from https://discourse.nixos.org/t/launching-emulator-without-android-studio/54933/6:
Repeated his problem, but solution seems to be elsewhere…

result/bin/run-test-emulator 
Looking for a free TCP port in range 5554-5584
We have a free TCP port: 5554
[=======================================] 100% Fetch remote repository...       
Auto-selecting single ABI x86_64
Do you wish to create a custom hardware profile? [no] \nLaunch the emulator
Waiting until the emulator has booted the device and the package manager is ready...
INFO    | Storing crashdata in: /tmp/android-pero/emu-crash-35.1.4.db, detection is enabled for process: 48925
INFO    | Android emulator version 35.1.4.0 (build_id 11672324) (CL:N/A)
INFO    | AVD device has path /tmp/nix-android-user-home-4Wog/avd/../avd/device.avd
INFO    | trying to check whether /nix/store/gcly4m5aygv647gj26mx1ld2j0c1mr5k-android-sdk-env/share/android-sdk is a valid sdk root
WARNING | /nix/store/gcly4m5aygv647gj26mx1ld2j0c1mr5k-android-sdk-env/share/android-sdk/system-images/android-33/google_apis_playstore/x86_64/ is not a valid directory.
WARNING | emulator has searched the above paths but found no valid sdk root directory.
PANIC: Broken AVD system path. Check your ANDROID_SDK_ROOT value [/nix/store/dnacqk6jiskmblhd4kvg1bhgf1hijmfb-androidsdk/libexec/android-sdk]!