Bug 33250 - A Clean Xamarin.Android build fails with "aapt.exe" exited with code -1073741819
Summary: A Clean Xamarin.Android build fails with "aapt.exe" exited with code -1073741819
Status: RESOLVED INVALID
Alias: None
Product: Android
Classification: Xamarin
Component: MSBuild ()
Version: 5.1
Hardware: PC Windows
: Normal normal
Target Milestone: ---
Assignee: Jonathan Pryor
URL:
Depends on:
Blocks:
 
Reported: 2015-08-20 07:07 UTC by steven.mark.ford.dev
Modified: 2017-09-19 16:49 UTC (History)
3 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED INVALID

Description steven.mark.ford.dev 2015-08-20 07:07:25 UTC
After upgrading to Xamarin 3.11.837.0 (Android 5.1.5.3) I now receive the following error if I do a clean build on my Xamarin.Android project:

"C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1490,3): error MSB6006: "aapt.exe" exited with code -1073741819."

If I build again following the error then the build completes. It is specifically on a clean build where this error occurs. (I also noticed that since upgrading <TargetFrameworkVersion>v4.4</TargetFrameworkVersion> is injected into my csproj file when building for the first time)
Comment 1 Jonathan Pryor 2015-08-20 08:45:56 UTC
Please provide diagnostic build output or (ideally) a repro project.
Comment 2 steven.mark.ford.dev 2015-08-20 08:48:38 UTC
Hi Jonathan,

Thanks for the quick response. Could you please advise how I should go about providing this.
Comment 5 steven.mark.ford.dev 2015-08-20 09:41:02 UTC
Hi Jonathan, 

I have attached the diagnostic build output to the bug report.
Comment 6 Jonathan Pryor 2015-08-20 15:02:25 UTC
Unfortunately, I don't know why it's failing. :-(

Could you please try executing the `aapt` command manually, from CMD.EXE?

>  C:\pc\Android\sdk\build-tools\21.0.1\aapt.exe package -f -m -M obj\Release\android\AndroidManifest.xml -J "C:\Users\Steven Ford\AppData\Local\Temp\s4ghzhmt.l04" --custom-package com.xxx.yyy -F obj\Release\android\bin\packaged_resources.bk -S obj\Release\res -S C:\dev\repo\gw_dev\yyy.Android\obj\Release\__library_projects__\Couchbase.Lite\library_project_imports\res -S C:\dev\repo\gw_dev\yyy.Android\obj\Release\__library_projects__\xxx.Core.Android\library_project_imports\res -S C:\dev\repo\gw_dev\yyy.Android\obj\Release\__library_projects__\SQLite.Net.Platform.XamarinAndroid\library_project_imports\res -S C:\dev\repo\gw_dev\yyy.Android\obj\Release\__library_projects__\SQLitePCL.raw\library_project_imports\res -S C:\dev\repo\gw_dev\yyy.Android\obj\Release\__library_projects__\Xamarin.Insights\library_project_imports\res -S C:\dev\repo\gw_dev\yyy.Android\obj\Release\resourcecache\95BBD754234F411643068961F624AF60\res -I C:\pc\Android\sdk\platforms\android-19\android.jar -A obj\Release\assets --auto-add-overlay --max-res-version 19
Comment 7 steven.mark.ford.dev 2015-08-21 07:21:13 UTC
I removed the {AndroidSDK}\build-tools\21.0.1 folder and it fixed the issue as my build now defaults to {AndroidSDK}\build-tools\20.0.0 (not that this is a permanent fix).
 
Seems to be a specific bug with Build-Tools 21.0.1 and certain solutions.
See:
1.http://stackoverflow.com/questions/10699439/aapt-failing-with-error-code-1073741819 

2.You will also notice on https://developer.android.com/intl/zh-cn/tools/revisions/build-tools.html it seems it is not advisable to use this version on windows:
"Build Tools, Revision 21.0.2 (October 2014): Complete updates for Eclipse ADT to solve instability issues on Windows platforms.
Build Tools, Revision 21.0.1 (October 2014): Initial updates for Eclipse ADT on Windows. Please use Revision 21.0.2."

At this point I don't know why it only started using build-tools\21.0.1 when I updated Xamarin. Any idea why this would be the case?
Comment 8 Jonathan Pryor 2015-08-21 14:46:03 UTC
> At this point I don't know why it only started using build-tools\21.0.1 when I
> updated Xamarin. Any idea why this would be the case?

How did you update Xamarin, through the "in-IDE" updater, or by re-running the original installer?

The installer usually installs the most recent versions of everything, so it's plausible that if you re-ran the installer 21.0.1 was installed.

The updater doesn't currently update the Android SDK (this is something we're working on), so if you only ran the updater I don't see how the SDK would have been updated..
Comment 9 steven.mark.ford.dev 2015-08-24 02:29:36 UTC
It was through the updater. Do think maybe in later versions of Xamarin if an explicit target compiler is not specified then the defaults changed from older to newer versions. Maybe the scan logic which scans for which sdks was updated.

Thanks for all the help.
Comment 10 Jon Douglas [MSFT] 2017-09-19 16:49:12 UTC
Thank you for taking the time to submit this report. After reviewing the description of this bug, we believe it no longer affects the current version of Xamarin.Android. If you are still experiencing the issue after updating your packages, please reopen this report with an attached reproduction.