Error using Xamarin AAPT

I just installed Xamarin studio on Windows 8, I am creating a C # android project and will try to compile it without any luck.

The error I get is in 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 -MC:\Users\Giuseppe\AppData\Local\Temp\i4va1gur.y4b\AndroidManifest.xml -JC:\Users\Giuseppe\AppData\Local\Temp\i4va1gur.y4b --custom-package androidlocationlogger.androidlocationlogger -FC:\Users\Giuseppe\AppData\Local\Temp\i4va1gur.y4b\resources.apk.bk -S obj\Debug\res -IC:\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 don't know how to debug this, given how little data it gives me ...

+6
source share
10 answers

This error is mainly due to the file names in your project, check these first..look also if the names have characters and spaces ... just fix them to get rid of these types of errors.

+12
source

In my experience, this usually happens due to some problem with the resources (in other words, something that was added to the projects in the resources folder - usually in the Drawable or Layout folder).

If you go into the Resource.Designer.cs file, it may provide some hints as to what the problem is with the project.

One possible solution is to delete any of the additional files that you added to the project, and try rebuilding it.

Another way that might work is to clean up the Build-> Clean Solution project, and then rebuild the solution.

If you just started, perhaps you can start a new project, and then open the files from this broken one and copy them on top or just sections of code - and build the project so that you can diagnose which file is wrong.

Please let me know if this was useful to you,

Regards, James.

+2
source

The added resource files (images, sound, etc.) should contain only [a-z0-9_.] - Ie no special characters other than "_" and ".",

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

+2
source

This error can also occur if you have installed Android build tools that Xamarin does not support. By default, the Xamarin.Android project prefers the latest version of the tools for creating Android. I had a 24.0.0 preview, but it was not supported. You can provide a manual build version of the tool by adding the AndroidSdkBuildToolsVersion property to your .csproj file. See Also: Xamarin.Android Build Process

+2
source

I was able to solve the same problem by deleting the bad android.axml files existing in the layout directory. If you copy the file and do not rename this file, it may exist with invalid file characters, which will cause a problem during the build process ...

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

Make sure you rename the layout file correctly and / or delete it from the project and rebuild it.

+1
source

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

+1
source

This error occurred in two situations for me.

1) if you have bad characters in the file name, at least appt reports an error in the diagnostic output if you are looking for it. (build-> log output = diagnostics)

2) if your layout files or menu files refer to a resource, it is either spelled incorrectly or missing. This is one hunt. It was an appt error without diagnostics.

In principle, any resource file that is in axml format can refer to drawings, lines and colors, menus, menu selectors ... etc. open each file one at a time until you find what you are linking to and what is not in your resource folders.

0
source

Setting file properties for an Android resource will do the trick.

0
source

for me it was @ in the resource file name, which caused the output of "aapt.exe" with an error code, after I renamed the resource file, the error was fixed.

0
source

If you mistakenly made 9 patches, you will get this error. I had to mark expandable patches on all four sides of my image so that the error would disappear.

-1
source

Source: https://habr.com/ru/post/948521/


All Articles