Adb: No such file or directory, after installing it with Intellij IDEA


I have a bug trying to manage the Android SDK and tools with Intellij IDEA.


The Android SDK installation went well, but the adb command is somehow missing.

What I did exactly

In Intellij IDEA, Appearance & behaviour > System Settings > Android SDK Settings, I clicked on Edit, checked everything (Android SDK and API 33 Android Tiramisu), let the location as is (home/romain/Android/Sdk in this case), clicked Next, and let the tool do its job…

The installation went well (just one error, Unable to run mksdcard SDK tool, but not sure it is relevant), and the tools are effectively installed in my home:

❯ ls -la /home/romain/Android/Sdk/platform-tools
total 14452
drwxr-xr-x  3 romain users    4096  2 mars  15:51 .
drwxr-xr-x 13 romain users    4096  2 mars  16:16 ..
-rwxr-xr-x  1 romain users 7933192  2 mars  15:51 adb
-rwxr-xr-x  1 romain users   57216  2 mars  15:51 dmtracedump
-rwxr-xr-x  1 romain users  305976  2 mars  15:51 etc1tool
-rwxr-xr-x  1 romain users 2465048  2 mars  15:51 fastboot
-rwxr-xr-x  1 romain users   13264  2 mars  15:51 hprof-conv
drwxr-xr-x  2 romain users    4096  2 mars  15:51 lib64
-rwxr-xr-x  1 romain users  262696  2 mars  15:51 make_f2fs
-rwxr-xr-x  1 romain users  262680  2 mars  15:51 make_f2fs_casefold
-rwxr-xr-x  1 romain users  873248  2 mars  15:51 mke2fs
-rw-r--r--  1 romain users    1157  2 mars  15:51 mke2fs.conf
-rw-r--r--  1 romain users 1070918  2 mars  15:51 NOTICE.txt
-rw-r--r--  1 romain users   18335  2 mars  15:51 package.xml
-rw-r--r--  1 romain users      38  2 mars  15:51
-rwxr-xr-x  1 romain users 1492400  2 mars  15:51 sqlite3

But in the Notifications tab, now I have:

Cannot run program “/home/romain/Android/Sdk/platform-tools/adb”: error=2, No such file or directory

Same error if I try to run the adb command in a terminal.

Some information


❯ file ~/Android/Sdk/platform-tools/adb
/home/romain/Android/Sdk/platform-tools/adb: ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/, for GNU/Linux 2.6.24, not stripped



❯ nixos-version
22.11.2912.d70f5cd5c3b (Raccoon)

IntelliJ IDEA

IntelliJ IDEA 2022.3.2 (Ultimate Edition)
Build #IU-223.8617.56, built on January 26, 2023
Runtime version: 17.0.5+10-nixos amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.

This does not exist on NixOS. Please use a nixpkgs provided adb.

Like android-tools, I guess…

But Intellij is looking for a complete Android SDK, so if I install only android-tools and tell Intellij to use the directory in which it was installed it complains.

So, another question could be: How to install a complete Android SDK?

To all nixos newbie like me:

There is a dirty but easy solution to this problem.

In configuration.nix, set programs.adb.enable = true;
and then use whereis adb to get a nix wrapped adb binary.
Copy it to ~/Android/Sdk/platform-tools/, remember to remove/backup original binary.
and the error message will gone.

This is not a good way to solve it and as the profile get rebuilt, the binary might be unusable.

Check out this repo: Building a complete Android SDK in your system is a better solution.