19

I'm ready to tear my hair out because I can't get Eclipse unstuck from a state where it thinks it can't find aapt:

Error executing aapt. Please check aapt is present at /usr/local/android-sdk-linux_x86/platform-tools/aapt

I've found a bunch of posts on this subject, which suggest deleting the error in the Eclipse UI, deleting R.java, rebuilding the project, restarting Eclipse, etc. These things help temporarily, but as soon as I edit an XML file, Eclipse gets borked again. It's getting really annoying to rebuild all my source and restart Eclipse every time I change an XML file.

aapt is clearly there:

$ ls -l /usr/local/android-sdk-linux_x86/platform-tools/aapt
-rwxr-xr-x 1 boris boris 3764858 2011-07-28 11:50 /usr/local/android-sdk-linux_x86/platform-tools/aapt

Is there a way to know exactly what the error is that's occurring? I tried looking in the Eclipse console output and in .metadata/.log in my project and didn't see anything related.

Boris Burtin
  • 811
  • 1
  • 7
  • 18

9 Answers9

14

Hit this again today, and discovered that verbose output from aapt doesn't help. It just spits out the aapt command to the console and fails without an error.

I think I've finally gotten to the bottom of what's going wrong. I believe that aapt is failing due to insufficient memory. My Eclipse process was using 1.2GB of memory. When Eclipse runs aapt, it forks the process which, from what I understand, allocates another 1.2GB just for running aapt.

I looked at my process list, and saw that Firefox was using almost 400MB of memory. I killed Firefox, and then aapt started working. Crazy.

Boris Burtin
  • 811
  • 1
  • 7
  • 18
10

Finally found the answer to my question here:

http://groups.google.com/group/android-developers/browse_thread/thread/bad9d488d2068260

Turns out that you can see the aapt command and output by setting "Build output" to "Verbose" in Preferences/Android/Build. Weird that they don't spit out the output when an error occurs.

Boris Burtin
  • 811
  • 1
  • 7
  • 18
  • I was trying to figure out how to build an Android project with library projects. Seeing the aapt command that Eclipse uses was a real help! – benvd Apr 05 '12 at 09:37
  • Whoever at Eclipse/Google thought "Build output silent" would be a sensible default? – Bart Friederichs Nov 18 '13 at 12:39
  • 2
    @benvd, I am seeing the same issue on my Eclipse. I set the build options to verbose, however I can't figure out in which window the actual build process is shown. – Flo Dec 12 '13 at 12:09
  • Same here, build is verbose, but where is the output?! – Radu Mar 17 '14 at 13:13
  • Output is in the Console pane. I had to restart eclipse to get the output to show, however. – deepwinter Apr 16 '14 at 02:40
5

In my case (fresh Eclipse installation, new project generated with wizard, errors like "Couldn't resolve R to variable") the problem turned out to be with absense of trailing slash in path to Android SDK at Preferences->Android.

MarSoft
  • 3,555
  • 1
  • 33
  • 38
4

Hint (suggested by Eclipse on Ubuntu): On 64-bit systems, make sure the 32-bit libraries are installed: sudo apt-get install ia32-libs

That has solved my problem !

nonozor
  • 865
  • 2
  • 14
  • 24
  • 1
    I installed Android studio in a Chromebook pixel with crouton and xfce4 ubuntu. My Android Studio installation was fresh and up to date. When I tried a hello world example, I got this error. It was solved installing 32-bit libraries. Just for reference – Ivancho Jun 11 '13 at 15:34
2

I had this because of a misdeclared ID in one of the resources files. I'm using Android Studio (but not gradle), and I had in a style declaration a reference to an @+id/... which isn't allowed, apparently. I had to declare the ID in another values xml files as <item type="id" name="..." />.

Benoit Duffez
  • 11,839
  • 12
  • 77
  • 125
1

This error can be caused by an invalid drawable id, such as

        android:icon="@drawable/ic_action_search_whatever"

If there is no drawable called ic_action_search_whatever aapt will die. Simple error, but not an easy one to debug!

deepwinter
  • 4,568
  • 2
  • 31
  • 37
1

In my case, the "Android SDK Build Tools" (version 20.0) was broken somehow. So I updated the tool to the latest one(21.1) using the "Android SDK Manager" & voila - it got OK :).

Touhid
  • 731
  • 1
  • 10
  • 25
1

Aapt is a 32bit application. I am running ubuntu 64bit. I needed some additional libraries. To get aapt working (this fixed my issues with the avd as well) just run these two commands:

sudo apt-get install lib32stdc++6

sudo apt-get install lib32z1

Enjoy

Vivek Samele
  • 340
  • 4
  • 8
-1

I actually noticed that I had converted my jpg file to png file that's why the aapt error was coming.