Android Studio Emulator Not Starting

I am not an Android developer but I’d like to have a working Android Studio to debug some WebViews.

I’m on NixOS, I installed android-studio through Nixpkgs, and I’m letting Android Studio handle all its dependencies on its own. Virtualization is enabled, the emulator starts, but is then stuck at the Google loading screen. The logcat output is full of errors.

1-04-13 10:50:51.047 0-0/? E/DEBUG: #00 pc 00000b99  [vdso] (__kernel_vsyscall+9)
2021-04-13 10:50:51.048 0-0/? E/DEBUG: #01 pc 0005ad68  /apex/com.android.runtime/lib/bionic/libc.so (syscall+40) (BuildId: 6e3a0180fa6637b68c0d181c343e6806)
2021-04-13 10:50:50.981 2188-2188/? A/DEBUG:       #03 pc 00013995  /system/lib/libbase.so (android::base::DefaultAborter(char const*)+37) (BuildId: 3abc3ce4c3b633a64b14c50cb931a64b)
2021-04-13 10:50:51.048 0-0/? E/DEBUG: #02 pc 00076511  /apex/com.android.runtime/lib/bionic/libc.so (abort+209) (BuildId: 6e3a0180fa6637b68c0d181c343e6806)
2021-04-13 10:50:50.983 2188-2188/? A/DEBUG:       #04 pc 0003ef53  /system/bin/iorapd (std::__1::__function::__func<void (*)(char const*), std::__1::allocator<void (*)(char const*)>, void (char const*)>::operator()(char const*&&)+35) (BuildId: 305b5b3011efe7aba0f9af9a9156d4fe)
2021-04-13 10:50:50.984 2188-2188/? A/DEBUG:       #05 pc 0001588f  /system/lib/libbase.so (android::base::SetAborter(std::__1::function<void (char const*)>&&)::$_3::__invoke(char const*)+79) (BuildId: 3abc3ce4c3b633a64b14c50cb931a64b)
2021-04-13 10:50:51.050 0-0/? E/DEBUG: #03 pc 00013995  /system/lib/libbase.so (android::base::DefaultAborter(char const*)+37) (BuildId: 3abc3ce4c3b633a64b14c50cb931a64b)
2021-04-13 10:50:51.051 0-0/? E/DEBUG: #04 pc 0003ef53  /system/bin/iorapd (std::__1::__function::__func<void (*)(char const*), std::__1::allocator<void (*)(char const*)>, void (char const*)>::operator()(char const*&&)+35) (BuildId: 305b5b3011efe7aba0f9af9a9156d4fe)
2021-04-13 10:50:51.053 0-0/? E/DEBUG: #05 pc 0001588f  /system/lib/libbase.so (android::base::SetAborter(std::__1::function<void (char const*)>&&)::$_3::__invoke(char const*)+79) (BuildId: 3abc3ce4c3b633a64b14c50cb931a64b)
2021-04-13 10:50:50.987 2188-2188/? A/DEBUG:       #06 pc 00006291  /system/lib/liblog.so (__android_log_call_aborter+33) (BuildId: bbac430fc6349b937996bb914e70c060)
2021-04-13 10:50:50.989 2188-2188/? A/DEBUG:       #07 pc 00014d14  /system/lib/libbase.so (android::base::LogMessage::~LogMessage()+436) (BuildId: 3abc3ce4c3b633a64b14c50cb931a64b)
2021-04-13 10:50:50.990 2188-2188/? A/DEBUG:       #08 pc 0003d5cd  /system/bin/iorapd (iorap::db::SchemaModel::GetOrCreate(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >)+2029) (BuildId: 305b5b3011efe7aba0f9af9a9156d4fe)
2021-04-13 10:50:50.992 2188-2188/? A/DEBUG:       #09 pc 0003c891  /system/bin/iorapd (main+641) (BuildId: 305b5b3011efe7aba0f9af9a9156d4fe)
2021-04-13 10:50:51.055 0-0/? E/DEBUG: #06 pc 00006291  /system/lib/liblog.so (__android_log_call_aborter+33) (BuildId: bbac430fc6349b937996bb914e70c060)
2021-04-13 10:50:51.057 0-0/? E/DEBUG: #07 pc 00014d14  /system/lib/libbase.so (android::base::LogMessage::~LogMessage()+436) (BuildId: 3abc3ce4c3b633a64b14c50cb931a64b)
2021-04-13 10:50:50.994 2188-2188/? A/DEBUG:       #10 pc 000522e3  /apex/com.android.runtime/lib/bionic/libc.so (__libc_init+115) (BuildId: 6e3a0180fa6637b68c0d181c343e6806)
2021-04-13 10:50:51.059 0-0/? E/DEBUG: #08 pc 0003d5cd  /system/bin/iorapd (iorap::db::SchemaModel::GetOrCreate(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >)+2029) (BuildId: 305b5b3011efe7aba0f9af9a9156d4fe)
2021-04-13 10:50:51.060 0-0/? E/DEBUG: #09 pc 0003c891  /system/bin/iorapd (main+641) (BuildId: 305b5b3011efe7aba0f9af9a9156d4fe)
2021-04-13 10:50:51.062 0-0/? E/DEBUG: #10 pc 000522e3  /apex/com.android.runtime/lib/bionic/libc.so (__libc_init+115) (BuildId: 6e3a0180fa6637b68c0d181c343e6806)
2021-04-13 10:50:51.003 2188-2188/? E/crash_dump32: unable to connect to activity manager: No such file or directory
2021-04-13 10:50:51.076 0-0/? E/init: updatable process 'iorapd' exited 4 times before boot completed
2021-04-13 10:50:51.072 2196-2196/? A/keystore: Check failed: chdir(argv[1]) != -1 chdir: /data/misc/keystore: No such file or directory
2021-04-13 10:50:51.072 2196-2196/? A/libc: Fatal signal 6 (SIGABRT), code -1 (SI_QUEUE) in tid 2196 (keystore), pid 2196 (keystore)
2021-04-13 10:50:51.078 2200-2200/? A/crash_dump32: crash_dump.cpp:474] failed to attach to thread 2196: Permission denied
2021-04-13 10:50:51.078 2200-2200/? E/libc: failed to connect to tombstoned: No such file or directory
2021-04-13 10:50:51.078 2200-2200/? E/crash_dump32: failed to connected to tombstoned to report failure
2021-04-13 10:50:51.078 2196-2196/? A/libc: crash_dump helper failed to exec
2021-04-13 10:50:51.152 0-0/? E/init: updatable process 'keystore' exited 4 times before boot completed
2021-04-13 10:50:51.113 2204-2204/? E/gatekeeperd: chdir: /data/misc/gatekeeper: No such file or directory
2021-04-13 10:50:51.184 0-0/? E/init: updatable process 'gatekeeperd' exited 4 times before boot completed

Especially this part seems to repeat a lot:

2021-04-13 10:50:46.095 0-0/? E/init: updatable process 'keystore' exited 4 times before boot completed
2021-04-13 10:50:46.110 2111-2111/? E/gatekeeperd: chdir: /data/misc/gatekeeper: No such file or directory
2021-04-13 10:50:46.183 0-0/? E/init: updatable process 'gatekeeperd' exited 4 times before boot completed
2021-04-13 10:50:50.495 2125-2125/? A/tombstoned: failed to open directory: /data/tombstones: No such file or directory
2021-04-13 10:50:50.495 2125-2125/? E/tombstoned: received fatal signal 6

Is there something obvious I’m missing? I just open Android Studio and hit run, meaning I’m not using any special Nix Shell for this. Unfortunately my Android developer colleagues are all using MacOS so things Just Work© for them and they can’t really help me with this.

You can try older/newer nixpkgs … It used to work IMHO.
So maybe checkout nixpkgs version when Android Studio was last updated cause that version (and deps) was known to work?

I am facing the same issue. I tried a couple of years ago and gave up and now I’m trying again with the latest version and getting the same results.