AAPT failing with error code -1073741819

三世轮回 提交于 2020-01-09 09:44:31

问题


Building the project throws the following error from AAPT. I've rebuilt the project, but it is still failing. I can't find any references anywhere to what this error code actually means. I'm using Java 6, and Android tools r19 in IntelliJ with ActionBarSherlock v4.1.0.

I/O error: Command
"C:\android-sdk-windows\platform-tools\aapt.exe package -m --auto-add-overlay --extra-packages com.actionbarsherlock -J C:\Users\Ollie\.IntelliJIdea11\system\compiler\project6.b9f5599b\.generated\aapt\Project.9617c193\production -M C:/Users/Ollie/Documents/Dropbox/Tech/project6/Source/project6/AndroidManifest.xml -S C:/Users/Ollie/Documents/Dropbox/Tech/project6/Source/project6/res -S C:/Users/Ollie/Documents/Dropbox/Tech/project6/Source/actionbarsherlock/res -I C:\android-sdk-windows\platforms\android-14\android.jar"
execution failed with exit code -1073741819

This build failure started happening after I added a dependency from my project to the ActionBarSherlock library project. If I remove that dependency, the project builds fine. If I add it back, it fails again.


回答1:


I had this problem under windows, I fixed it by removing a @+id in a style item definition in the styles.xml. I spoke to someone else who didn't know exactly why but had found using +id in style files to often cause problems.




回答2:


Update Oct. 27, 2014 -

the problem is fixed with Android SDK Build-tools rel. 21.0.2, sigh of relief... Guess I'll leave the rest of this post as it was, in case someone with v. 21.0.1 runs into this problem, or if the bug returns in future releases of the tools. Maybe it'll save someone bunging head against a tool-bug wall, reviewing all other posts and their code for a whole day.

Original post from Oct. 18, 2014

A new twist on this old issue... Today, Oct. 18, 2014, after upgrading to just released Android SDK v. 21 on my Windows 7 computer, using aapt.exe from android-sdk\build-tools\21.01\ directory crashes each time with the same exit code -1073741819. Tried all the answers suggested in this thread before my post to no avail. Then just copied the old version of aapt.exe from 20.0.0 (also tried from 19.1.0 tools directory), and in each case it worked fine. No issues (just had to clean-rebuild the project with each version of aapt.exe tested).

Is aapt.exe for Windows, in Android SDK built tools version 21.0.1 broken? Does anyone else see this problem?

Greg




回答3:


For anyone else experiencing this issue in Android Studio, this is how I solved it:

I copied the aapt.exe command that shows in the output window. For example:

C:\android-sdk-windows\platform-tools\aapt.exe package -m --auto-add-overlay --extra-packages com.actionbarsherlock -J C:\Users\Ollie\.IntelliJIdea11\system\compiler\project6.b9f5599b\.generated\aapt\Project.9617c193\production -M C:/Users/Ollie/Documents/Dropbox/Tech/project6/Source/project6/AndroidManifest.xml -S C:/Users/Ollie/Documents/Dropbox/Tech/project6/Source/project6/res -S C:/Users/Ollie/Documents/Dropbox/Tech/project6/Source/actionbarsherlock/res -I C:\android-sdk-windows\platforms\android-14\android.jar

At the end I appended the -v to the end of that command and ran it in a command prompt window. That switch turns on verbose logging. Eventually the command will fail, but the very last file that it attempts to package is the culprit. I suggest focusing your efforts on that file.




回答4:


General solution to this problem lies in XML code. There is something in the XML code which is being pointed , but not present. In my case, a unreachable string causes this error.

<item android:title="@string/action_settings">  

Due to some code merging, this string code deleted, and compiler is unable to find it.I changed it & whoop.. error is gone.
In most of the languages, 1073741819 error is usually thrown whenever there is problem accessing resources




回答5:


Make sure all your @+id/... (in main.xml and others) are also registered in strings.xml.

The problem I had was that <item android:id="@+id/menu_help" android:title="@string/menu_help"/> in my main.xml file was not defined in my strings.xml file.




回答6:


Take a look at here.
It is related to Android Develop's second class, of adding action buttons.
It is simply that the drawable "ic_action_search" is not present. Well, it was the case for me.
The class links to Action bar icon pack where you can find your missing PNGs and add to your project.

Hope it helps,
SJ




回答7:


I think aapt ErrorCode -1073741819 means Android resources are conflict or illegal. Whenever I meet this error on android projects of others' or my own, I usually find required attributes in layout/xxx.xml are missing, or id, name attributes are conflicts in different layout/xxx.xml




回答8:


I had the same problem in Eclipse. Eclipse now and then shows up those kind of errors, a simple refresh in my project fixed that error for me.




回答9:


Had the same problem.There was a reference inside an layout xml file pointing to an object that wasn't in the source code anymore.You probably should check your main layout files first.




回答10:


I just faced this issue again. Previous time I was not able to found the reason of the error so I had to clear everything and carefully add files and resources one by one. But now I found another reason for this error. I used method provided here by Software.Developer but in my case the culprit was not the last line but penultimate line. It was a menu xml file and the problem was at the first line in this file. It was empty and the xml declaration

xml version="1.0" encoding="utf-8"

was placed at the second line. IntelliJ IDEA static analyzer doesn't highlight this error until you open the file and compiler just crash at the compilation. So make sure all of your xml files (layouts, styles, menus) have proper xml declarations placed at the first line of the file.




回答11:


I fixed this with cleaning the project before compiling it again.

The error code I got is -1073741502 which is slightly different, but I think it's just the id that generated from previous build of aapt.




回答12:


In my case problem was in my menu.xml. Look at this one:

<menu xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    >

    <item android:id="@+id/action_help"
        android:title="@string/help"
        android:orderInCategory="100"
        app:showAsAction="never"
        />
</menu>

Renaming namespace for app:showAsAction from app to android solved this problem. Here goes the right way

<item android:id="@+id/action_help"
    android:title="@string/help"
    android:orderInCategory="100"
    android:showAsAction="never"
    />



回答13:


One more resource problem - add formatting="false" to your strings which contain %s formatting characters.

See more at Android XML Percent Symbol




回答14:


In my case (Android Studio on Windows 8.1) aapt would sometimes get stuck and every launch from command line would crash (but not when double-clicked in Explorer). When I terminated all cmd.exe and conhost.exe processes in Task Manager clean & build went just fine.




回答15:


this error will be generated when your xml has some problems but eclipse will not show real problem when Project>Build Automatically is checked

First thing you must do is to uncheck that option, Build All, and see problems window.

for me, I deleted a string from resources, but not its usage, so it takes 2 working days from me to find out what the problem is




回答16:


Generally this error is observed due to some missing parameter or some syntax error in xml file.

You can refer the Messages view for gradle build. There it states, which file is having error. In my case, in one of the layout xml, there was some extra character.




回答17:


Try removing the build tool with versions earlier than 19 from the android build tool folder, then install build tool 19 from the sdk manager, copy the lib folder and aapt.exe to platform-build folder.



来源:https://stackoverflow.com/questions/10699439/aapt-failing-with-error-code-1073741819

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