Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Stuck on Xamarin AAPT error

I have just installed Xamarin studio on Windows 8, I create a C# android project, and try to compile it with no luck.

The error I get is on the AAPT tool, but even with verbose output from msbuild all I get is the following in the output window:

Task "Aapt"
Aapt Task
  AssetDirectory: 
  ManifestFile: C:\Users\Giuseppe\AppData\Local\Temp\i4va1gur.y4b\AndroidManifest.xml
  ResourceDirectory: obj\Debug\res\
  JavaDesignerOutputDirectory: C:\Users\Giuseppe\AppData\Local\Temp\i4va1gur.y4b
  PackageName: AndroidLocationLogger.AndroidLocationLogger
  UncompressedFileExtensions: 
  ExtraPackages: 
  AdditionalResourceDirectories: 
  LibraryProjectJarsWildcard: obj\Debug\__library_projects__\*.jar
  ExtraArgs: 
C:\Users\Giuseppe\AppData\Local\Android\android-sdk\platform-tools\aapt.exe package -f -m -M C:\Users\Giuseppe\AppData\Local\Temp\i4va1gur.y4b\AndroidManifest.xml -J C:\Users\Giuseppe\AppData\Local\Temp\i4va1gur.y4b --custom-package androidlocationlogger.androidlocationlogger -F C:\Users\Giuseppe\AppData\Local\Temp\i4va1gur.y4b\resources.apk.bk -S obj\Debug\res -I C:\Users\Giuseppe\AppData\Local\Android\android-sdk\platforms\android-8\android.jar --auto-add-overlay 
C:\Program Files\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(707,2): error MSB6006: "aapt.exe" exited with code -1073741816.
Done executing task "Aapt" -- FAILED.
Done building target "_UpdateAndroidResgen" in project "AndroidLocationLogger.csproj" -- FAILED.

I really have no idea how to debug this, given how little data it is giving me...

like image 703
Giuseppe Maggiore Avatar asked Jul 02 '13 07:07

Giuseppe Maggiore


6 Answers

This error mainly occurs due to the name of files in your project,check these first..look also if the names have symbols and spaces...just correct them to free from these types of errors..

like image 84
vivek Avatar answered Oct 31 '22 05:10

vivek


From my experience this is usually come about because of some issue with the Resources (in other words something which has been added to the projects under the Resources Folder - usually in the Drawable or Layout folder).

If you go into the Resource.Designer.cs file it might provide some clues as to what the issue is with the project.

One possible solution is to remove any of the additional files which you have added to the project and try to rebuild it.

Another method which might work is to Clean the project Build-> Clean Solution and then rebuild the solution.

If you have just started perhaps you could start a new project and then open files from this broken one and copy them over - or just sections of code - and build the project up so that you can diagnose which file is the erroneous one.

Please let me know if this has been of any use to you,

Regards, James.

like image 40
James Cobold Avatar answered Oct 31 '22 05:10

James Cobold


Resource files added (images, sound etc) should contain only [a-z0-9_.] - I.e no special characters allowed other than '_' and '.',

otherwise you will get this error. "aapt.exe" exited with code 1. (MSB6006)"

like image 42
VK Mallaya Avatar answered Oct 31 '22 05:10

VK Mallaya


Such error also may occur when you have Android build tools installed, which Xamarin does not support. By default Xamarin.Android project prefer the newest version of Android build tools. I had 24.0.0-preview, but it was not supported. You can provide build tools version manually by adding AndroidSdkBuildToolsVersion property in your .csproj file. See also: Xamarin.Android build process

like image 28
stang Avatar answered Oct 31 '22 05:10

stang


I have been able to resolve this same issue by deleting bad android.axml files that exist in the layout directory. If you copy a file and don't rename that file it may exists with invalid file characters that will cause an issue during the build process...

For example: "myLayout (copy).axml".

Make sure to rename your layout file correctly, and/or delete them from the project and re-build.

like image 37
Bud Flynn Avatar answered Oct 31 '22 04:10

Bud Flynn


If you are using .resx files for localization, make sure you set their "Build Action" to "Embedded Resource"

like image 41
breez Avatar answered Oct 31 '22 05:10

breez