Android Eclipse Error executing aapt: return code 139

大城市里の小女人 提交于 2019-12-18 04:34:32

问题


I have an Android application project that suddenly stopped to work. There is apparently no error, but when I try to launch, I get this:

Error executing aapt: return code 139

I tried to clean the project and its dependent library project, restarted Eclipse, updated to latest ADT and SDK versions, etc. but all failed. I also have this other error sometimes (without changing anything):

Error generating final archive: java.io.FileNotFoundException: .../bin/resources.ap_ does not exist

I'm completely lost.

MORE INFO

I spent hours to disassemble and reassemble everything piece by piece, and finally found what causes these errors, though I still don't understand anything better... I had a resource like this:

<resources>
<integer-array name="titi">
<item>@+id/toto</item>
</integer-array>
</resources>

I removed it and everything worked again... Of course the resource file had no error at all. Half a day lost for nothing, this Eclipse is driving me mad 8-/ Am I the only one?


回答1:


Just had the same issue and the problem was that I had a menu file inside the menu folder which had an android:title="@string/.." that did not exist in my strings file. After adding it and doing a Project > Clean the problem is gone.




回答2:


Don't use @+id/... here:

<?xml version="1.0" encoding="utf-8"?>    
<resources>
    <integer-array name="titi">
    <Item>@+id/Toto</item>
    </integer-array>
</resources>

@+id/... can only be used in layout resources.

Use @id/... and generate ids with help resource file if needed: res/values/ids.xml:

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <item type="id" name="toto" />
</resources>

http://developer.android.com/guide/topics/resources/more-resources.html#Id




回答3:


I just moved a project away from using the Android v7 appcompat support library and encountered this problem. Turns out that I had a bunch of menu resource files that were still using the appcompat version of some of their properties.

I used to have this:

<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:compat="http://schemas.android.com/apk/res-auto">
    <item
        android:id="@+id/conversations_activity_menu_contacts"
        android:title="@string/contacts"
        compat:showAsAction="ifRoom|withText" />
</menu>

But then corrected the problem by changing them to this:

<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
    <item
        android:id="@+id/conversations_activity_menu_contacts"
        android:showAsAction="ifRoom|withText"
        android:title="@string/contacts" />
</menu>



回答4:


Hit the same issue, after an hour or so of playing the issue was tracked down to a single quote " ' ", being present in a resource . Removed the quote and the error went away.




回答5:


AAPT errors are sometimes caused by insufficient memory for eclipse to run in. See:

How to diagnose "Error executing aapt" error in Eclipse?

For the second part of your problem, see this:

Android Packaging Problem: resources.ap_ does not exist



来源:https://stackoverflow.com/questions/13865748/android-eclipse-error-executing-aapt-return-code-139

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