27

Recently installed Android Studio 1.0.1 (old version for some reasons) on Ubuntu 15, and I am trying to create a new project. Whenever I build it I get this error

Cannot run program "/home/user/Android/Sdk/build-tools/23.0.2/aapt": error=2 No such file or directory"

The file exists there.

ROMANIA_engineer
  • 54,432
  • 29
  • 203
  • 199
Em Ae
  • 8,167
  • 27
  • 95
  • 162
  • 1
    Possible duplicate of [Error: Cannot run aapt](http://stackoverflow.com/questions/18041769/error-cannot-run-aapt) – jk2K Aug 31 '16 at 02:13

3 Answers3

66
sudo apt-get install lib32stdc++6 lib32z1
dees91
  • 1,211
  • 13
  • 21
  • 6
    Works great but would you please provide an explanation? – Nonos Mar 07 '16 at 22:36
  • It works. In case others wonder: it doesn't work with lib64stdc++6:i386 and lib64z1:i386 instead. – Salim May 02 '16 at 14:45
  • Please note, with android build tools >= 24.0.0, this is no longer required – Jaymes Bearden Aug 24 '16 at 20:13
  • 6
    @Nonos and Saeed Darvish: it works because your Ubuntu must be 64-bit and aapt needs 32-bit libraries to run, so it needs some 32-bit libraries installed. – dakshbhatt21 Oct 15 '16 at 02:11
  • Just run `file build-tools/23.0.3/aapt` and the result is `ELF 32-bit LSB shared object`, that is, a 32-bit executable. – zhy Sep 06 '17 at 12:03
  • Also works for docker images of JDK, that are 32 bits images. this is cases for CI/CD servers and services like Buddy Works – alacret May 23 '18 at 04:35
0

please check your compileSdkVersion and buildToolsVersion and targetSdkVersion please same the value. simple :

compileSdkVersion "23"
buildToolsVersion "23"
targetSdkVersion "23"

Abhinav Singh Maurya
  • 3,313
  • 8
  • 33
  • 51
luffynas
  • 69
  • 2
  • 4
0

I am using react-native for android. I encountered the same problem

Cannot run program "/home/user/Android/Sdk/build-tools/23.0.2/aapt": 
error=2 No such file or directory"

but I changed the build tool version to 26.0.2 and it solved build completed without any problem. I barely know why it happened.