Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

'aapt' error. Pre Compiler Build aborted

I'm using Eclipse 4.2.2 with Android SDK 22.0.1 to construct an Android application which uses the Facebook and Google Play Services lib. However I'm stuck with a problem: every time I include one or both of the library the aapt verbose mode crash in some point like this (I assume this also crash with verbose mode off, because the R.java files are not created on my project):

[2013-06-21 01:33:40 - Project]     (new resource id com_facebook_placepickerfragment_list_row from /Users/Solens/workspace/FacebookSDK/res/layout/com_facebook_placepickerfragment_list_row.xml)
[2013-06-21 01:33:41 - Project]     (new resource id com_facebook_us
[2013-06-21 01:33:41 - Project] 'aapt' error. Pre Compiler Build aborted.

If I don't include the libraries the project compile correctly. I've tried several solutions like clean -> build project, trying to update the sdk tools (however I'm using the lastest revision), but any of them have worked. I even tried switching OS to Windows 7 (I use Mountain Lion) and the same problems arise.

The funny thing is I have another project which both of the libraries added, the only difference is this other project has, by far, less resources than my crashed project.

I've been stuck on this problem by two weeks and still not found a solution.

Thanks in advance.

P.S.: related question -> aapt erros when generating resource ids

like image 811
nigonzalezm Avatar asked Jun 21 '13 06:06

nigonzalezm


2 Answers

I'm getting the same error, and try using the older android build tools as @Onko suggest in the second comment solve the problem. The android build tool v19 won't report the error in your resource files.

So what I did was, re-download the Build-tools v18 in SDK Manager and delete the v19.0.1 then restart the eclipse and clean and force eclipse to rebuild the project. After that I found what is the error in my resource xml file.

like image 50
worawee.s Avatar answered Oct 21 '22 10:10

worawee.s


I've been stuck at this nasty error at least few times and every time I lost hours to find the exact cause. One possible reason could be something malformed in a menu XML. In example ifRoom is misspelled.

<menu xmlns:android="http://schemas.android.com/apk/res/android" >    
    <item
        android:showAsAction="iFroom|withText" 
        ...
    />

</menu>    

It is not detected by the XML editor. Nor it is reported as an error. Aapt just crashes without error message. Also be cautious about other kind of misspell mistakes in the menu XML. It seems the menu XML verification tool is not fully complete.

like image 24
WindRider Avatar answered Oct 21 '22 10:10

WindRider