21

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.

gregko
  • 5,642
  • 9
  • 49
  • 76
Ollie C
  • 28,313
  • 34
  • 134
  • 217
  • I can't reproduce it. Please try this sample and verify that you've set the dependency properly: https://dl.dropbox.com/u/2752840/ActionBarSherlock.zip. – CrazyCoder May 22 '12 at 14:46

17 Answers17

18

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.

Daniel Egan
  • 456
  • 5
  • 4
  • This fixed it for me too, I had a in my style.xml, and a contradicting in my layout.xml file. Removing the one from the style document fixed it for me. Thanks for your help! – James Becwar Mar 29 '13 at 15:46
  • In my case I had problem with ids.xml and item . Don't use this! – Warlock Aug 08 '13 at 12:52
  • 1
    I had duplicate menu IDs in separate menu XML files. basically when you have duplicate IDs in any of your XML files the error occurs. – Abhishek May 14 '14 at 19:19
  • In my case I had defined a menu item with an invalid `android:title`, e.g. `android:title="@string/NOT_EXISTING_ID"`. Fixing the String-ID solved the problem. No idea why Eclipse shows this strange error message instead of a simple "Unknown String ID..." – Andrei Herford Jun 25 '14 at 11:21
  • In my case, I had used the wrong package. instead of, for example, `android:showAsAction=...` I needed `:showAsAction=...` – cnfw Jan 27 '15 at 19:04
8

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

Community
  • 1
  • 1
gregko
  • 5,642
  • 9
  • 49
  • 76
  • This is happening to me too. Same project on Linux compiles just fine. This is a problem specific to windows (mine is Windows 8.1 Pro 64bit). Raplacing aapt.exe fixes it in the mean time – unify Oct 24 '14 at 21:24
  • @unify, thanks! Good to know that it's not only me. Wish I knew how to submit such bugs to Google. They don't make it easy. – gregko Oct 24 '14 at 21:50
  • https://code.google.com/p/android/issues/list?cursor=android%3A76877 let me know when you are done creating it and I'll upvote it and add my comments – unify Oct 24 '14 at 21:54
  • @unify, it seems that the issue was fixed with Android SDK Build-tools rel. 21.0.2. Thanks! – gregko Oct 27 '14 at 15:00
5

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.

Software.Developer
  • 991
  • 10
  • 16
3

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

2

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.

Percy Vega
  • 1,449
  • 1
  • 16
  • 13
2

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

Community
  • 1
  • 1
2

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

0

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.

user3154700
  • 101
  • 1
  • 4
0

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.

cgew85
  • 86
  • 1
  • 7
0

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.

Allesad
  • 256
  • 2
  • 8
0

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.

dieend
  • 2,231
  • 1
  • 24
  • 29
0

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"
    />
vaninv
  • 153
  • 2
  • 5
0

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

See more at Android XML Percent Symbol

Community
  • 1
  • 1
svenkapudija
  • 5,128
  • 14
  • 68
  • 96
0

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.

Eugen Pechanec
  • 37,669
  • 7
  • 103
  • 124
0

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

Homayoun Behzadian
  • 1,053
  • 9
  • 26
0

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.

Swapnil Kale
  • 2,620
  • 2
  • 23
  • 21
-1

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.

quetzalcoatl
  • 32,194
  • 8
  • 68
  • 107