7

I have a fresh install of Ubuntu and Android Studio. I have installed open jdk7 (for some reason it ended up in directories suffixed "amd64" even though I am running an Intel CPU, but I guess that's just a name?) as well as some SDK files.

I then created an empty project and now I am getting an error displayed near the bottom of the window. I guess this is a Gradle error (am very new to AS)

Error:Execution failed for task ':app:mergeDebugResources'.
> /root/AndroidStudioProjects/HockeyGame/app/build/exploded-aar/com.android.support/appcompat-v7/19.1.0/res/drawable-xxhdpi/abc_ic_voice_search.png: Error: Cannot run program "/opt/android-studio/sdk/build-tools/android-4.4.2/aapt": error=2, No such file or directory

I was thinking maybe this was a file privilege problem (because aapt does indeed seem to exist), so I set the privileges to 775 recursively. And I am also starting AS with sudo (sudo sh studio.sh).

Any ideas? I am partly trying AS out in Android because I was having problems getting it to run under a cluttered Windows install (and also for the fun of it), so this is disappointing.

edit: It turned out 64-bit Ubuntu isn't fit to run 32-bit executables out of the box.

Emil Laine
  • 41,598
  • 9
  • 101
  • 157
Christofer Ohlsson
  • 3,097
  • 4
  • 39
  • 56
  • Not necessarily related to your problem, but you shouldn't be running Android Studio using `sudo` - you should be running it using your own user. You should also definitely not be setting 755 privileges - only directories and executables should have the executable bit set. If you want to make sure, try `chmod -R ugo+rX` (with a capital `X`) - but this shouldn't be a problem if you just open the Android Studio bundle. Personally, I made it work with the Oracle JDK, I don't know what the deal is with the amd64 suffix – orip May 04 '14 at 13:27
  • [Android Studio - mergeDebugResources exception](http://stackoverflow.com/q/17121033/1693859) – Sam R. May 04 '14 at 13:30
  • @SamRad okay I'm having a look there. So I added the classpath bit to build.gradle, but got a build script error saying "unsupported Gradle DSL method found". Anything else in there I could try? Maybe that thread has become a bit dated? – Christofer Ohlsson May 04 '14 at 13:42
  • @orip thanks, I will refrain from starting with sudo, and also reconsider the privilege settings. And perhaps install oracle JDK instead of open. Do you think that this realistically could solve my problem? – Christofer Ohlsson May 04 '14 at 13:43
  • Not sure about the original problem with aapt not being recognized, but at this point it's a problem with your build.gradle file. I'm guessing you've put stuff in your top-level build file that belongs in the module-level build file instead. – Scott Barta May 04 '14 at 14:31
  • @ScottBarta I haven't touched my build files. This literally happened as soon as I had created the project file. – Christofer Ohlsson May 04 '14 at 14:36
  • Well, I reinstalled the OS and then got me some Oracle JDK going. To no avail. Same problem. Right out of the box. – Christofer Ohlsson May 04 '14 at 18:44
  • 2
    aapt is built for 32 bit only. Is your OS configured to run 32bit executables? – Xavier Ducrohet May 05 '14 at 16:58
  • Yes, I learned this via Reddit the other day. I do feel a bit silly. But at the same time, I didn't see it mentioned in the install guides I read. – Christofer Ohlsson May 06 '14 at 06:34

1 Answers1

18

I solved it by running

sudo apt-get install lib32stdc++6
sudo apt-get install lib32z1

Reference: https://code.google.com/p/android/issues/detail?id=67155

Jayakumar Bellie
  • 9,298
  • 2
  • 17
  • 14