'aapt' error. Pre Compiler Build aborted

人盡茶涼 提交于 2019-12-01 18:28:56

问题


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


回答1:


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.




回答2:


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.



来源:https://stackoverflow.com/questions/17229306/aapt-error-pre-compiler-build-aborted

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!