"aapt.exe" exited with code 1 when building Mono for Android project "aapt.exe" exited with code 1 when building Mono for Android project android android

"aapt.exe" exited with code 1 when building Mono for Android project


Step 1: get more info

If you run across this error, hopefully, you will also run across a post from Jonathan Pryor replying to someone else with the same problem. The suggestion is to turn on more verbose logging from MSBuild to see if you get something useful out of those messages.

In the Visual Studio Options dialog, go to "Projects and Solutions" then "Build and Run". Switch the "MSBuild project build output verbosity" from "Minimal" to "Normal" and build your project again. After doing so, I got this message which was far more helpful. Apparently, resources cannot include anything but letters, numbers, periods, and underscores ([a-z0-9_.]).

MSBuild normal verbosity logging

Solution

Rename file within the required restrictions and build again.

While this error message may come up for far more situations than filename restriction issues, a filename change fixed this particular issue completely.


Similar solution for me, I needed to remove the dashes ('-') from my PNG filenames in the resources folder


In Mono.Android projects this error occurres when a Resources/Layout axml file has whitespaces in the name, eg. "Copy of xxxx.xaml"