Bug 40156 - Seeing an AAPT error with the latest Build-tools r24 when building projects on Windows that use AppCompat
Summary: Seeing an AAPT error with the latest Build-tools r24 when building projects o...
Status: RESOLVED UPSTREAM
Alias: None
Product: Android
Classification: Xamarin
Component: MSBuild (show other bugs)
Version: unspecified
Hardware: PC Windows
: High critical
Target Milestone: ---
Assignee: Jonathan Pryor
URL:
: 40863 42097 (view as bug list)
Depends on:
Blocks:
 
Reported: 2016-04-06 13:04 UTC by Abhishek
Modified: 2017-06-21 23:08 UTC (History)
8 users (show)

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


Attachments
aapt-bug.zip (5.44 KB, application/zip)
2016-07-05 20:35 UTC, Jonathan Pryor
Details

Comment 1 Peter Collins 2016-04-06 14:27:00 UTC
I'm able to reproduce this, the issue here is caused by new preview Build-tools (24 rc2). I'm only able to reproduce this issue on Windows, and I can repro from XS, VS and command line:

Diagnostic build output:
https://gist.github.com/pjcollins/d81ad18f681c6369122288d7c712fe51
Comment 3 Atsushi Eno 2016-04-06 16:30:55 UTC
This suggest to make sure to clean up every related products.
http://stackoverflow.com/questions/27564002/aapt-exe-exited-with-code-1073741819

If you could reproduce the error even after fresh reinstallation let us know.
Comment 4 Peter Collins 2016-04-06 18:40:48 UTC
After some further investigation, this seems to only happen for me with projects that reference the AppCompat NuGet. @Abhishek can you confirm? Are you still able to reproduce if you use a base template with no NuGets?
Comment 5 Abhishek 2016-04-06 18:53:58 UTC
If I create the android application with target platforms "modern development" on Windows XS . Then I am successfully able to build and deploy the application on device. 

Screencast: http://www.screencast.com/t/JpB1KcHFYpT0
Build Output: https://gist.github.com/Abhishekk360/a5baad2e08cc583274fe804327994862
Application Output: https://gist.github.com/Abhishekk360/7e4a64ae6385b8db0808351b0d3262e7

But If I create android application with target platforms "Maximum Compatibility" then I am getting the reported behavior.
Comment 7 Peter Collins 2016-05-04 20:40:10 UTC
*** Bug 40863 has been marked as a duplicate of this bug. ***
Comment 8 Peter Collins 2016-06-15 20:53:23 UTC
This is still reproducible using Build tools 24 that were released to the main Android SDK Manager "Tools" channel today.
Comment 9 Peter Collins 2016-07-05 16:28:16 UTC
@Atsushi This reproduces on multiple Windows environments with multiple versions of XA. I am able to reproduce this on a clean VM with no VS installed, and on another machine uninstalling Visual Studio and Xamarin and then re-installing Xamarin does not resolve this issue. 

Jeremie and I recently spent some time trying to debug this further but we were unable to get any additional error logging out of aapt.
Comment 10 Jonathan Pryor 2016-07-05 20:35:38 UTC
Created attachment 16578 [details]
aapt-bug.zip
Comment 11 Jonathan Pryor 2016-07-05 20:40:55 UTC
I believe that this is an aapt bug on Windows.

1. Download Attachment #16578 [details]
2. Unzip it
3. Edit aapt-bug\Makefile and edit the filesystem paths as appropriate for your machine.
4. From CMD.EXE, run `NMAKE`:

  > NMAKE
> Processing image: res\drawable\icon.png
> NMAKE : fatal error U1077: '"C:\Program Files (x86)\Android\android-sdk\build-tools\24.0.0\aapt.exe"' : return code '0xff'
> Stop.

Running on OS X results in no error:

> $ make make AAPT=/opt/android/sdk-tool/sdk/build-tools/24.0.0/aapt \
> ANDROID_JAR=/opt/android/sdk-tool/sdk/platforms/android-23/android.jar
> ...
> Done!

Additionally, it *appears* to be that `aapt` "doesn't like" the Xamarin/Visual Studio-provided Icon.png template file, which differs from all of the Xamarin Studio Icon.png template files. If I replace `res\drawable\icon.png` with the Xamarin Studio `Resources\drawable-hdpi\Icon.png`, `aapt` executes without error.
Comment 12 Peter Collins 2016-07-05 21:19:20 UTC
Logged upstream:
https://code.google.com/p/android/issues/detail?id=215209

Removing the milestone, and will revisit once there's action on the upstream bug.
Comment 13 Peter Collins 2016-07-18 19:57:15 UTC
Filed upstream as https://code.google.com/p/android/issues/detail?id=215209, and appears to be fixed in build tools 24.0.1.
Comment 14 Brendan Zagaeski (Xamarin Team, assistant) 2017-06-21 23:08:32 UTC
*** Bug 42097 has been marked as a duplicate of this bug. ***

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.


Create a new report for Bug 40156 on Developer Community or GitHub if you have new information to add and do not yet see a matching report.

  • Export the original title and description: Developer Community HTML or GitHub Markdown
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments


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.

Related Links: