“aapt.exe” exited with code -1073741819

2019-02-20 22:19发布

问题:

I just installed Xamarin Studio and Xamarin for visual studio 2015- trial version. All versions are the latest stable versions. I start with a new android project, but when the build won't succeed. I checked google, and it seems like a recurring problem. I've all my sdk tools updated as well. One of the blogs said to uninstall and reinstall everything xamarin from system. Did that as well. But to absolutely no avail. The problem is still the same.

on xamarin forum, a similar question is already there: http://forums.xamarin.com/discussion/11311/build-fails-on-android-projects-appt-exe-exited-with-code-1073741816 But it's still not properly answered. Here's my build output from visual studio with verbose mode on.

[https://docs.google.com/document/d/1Ue0o4YiYeegxLoWep-yTrUJQFIC90G24CTZYztIPXC4/edit?usp=sharing](Build Output from visual studio (verbose mode on) )

The problem looks to be related to MSBuild configuration params misconfigured or not-configured. Not sure but i believe it is something related to _UpdateAndroidResgen .

When I run this command from cmd with adminsitrator priviliges, I get this:

C:\Users\Pratik\AppData\Local\Android\android-sdk\build-tools\21.0.1\aapt.exe package -f -m -M C:\Users\Pratik\AppData\Local\Temp\kantu3nz.kia\AndroidManifest.xml -J C:\Users\Pratik\AppData\Local\Temp\kantu3nz.kia --custom-package app1.app1 -F C:\Users\Pratik\AppData\Local\Temp\kantu3nz.kia\resources.apk.bk -S C:\AndroidProjects\App1\App1\obj\Debug\res -I C:\Users\Pratik\AppData\Local\Android\android-sdk\platforms\android-21\android.jar --auto-add-overlay

aapt.exe crashes, and when trying to debug, it shows AccessViolationException.

Any relevant suggestions are highly appreciated.

Thanks.

回答1:

As already mentioned in the question, re-installing everything Xamarin also did not work. Uninstalling visual studio 2015 worked. The following steps did the trick (for me, at least):

1) Uninstall visual studio 2015 beta.

2) Uninstall Xamarin for visual studio.

3) Do a system restart.

4) Re-install Xamarin studio. Now, the compiles with both Xamarin studio as well as VS2013.

PS: This is one of those last-resort solutions. Any better and more accurate answers are always welcome.