Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
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
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.
I am experiencing troubles with aapt.exe .. very often it suddenly takes about 35% of CPU and causes Visual Studio to hang. E.g. when I try to install Nuget to Android project, it hangs for about 10 minutes. When I build and deploy Android project, it hangs every time for about 30 seconds longer than it should. Even if I build iOS project and Android project is not unloaded, it also hangs about 30 seconds (when I unload the Android project, it does not happen). And also after I open some Android xml in Android Designer, then every saving of any xml file hangs for about 30 seconds - when I reboot PC, this xml-problem does not happen but when I open xml in Android Studio, it happens again until I reboot.
Every time this hang occurs, aapt.exe is on the top of CPU usage.
I managed to workaround this issue by adding <AndroidResgenExtraArgs>--no-crunch </AndroidResgenExtraArgs> to the Android .csproj file. When I do this, aapt.exe is not taking CPU and VS is not hanging. But some UI on android looks ugly (like compatswitch, tablayout etc).
My co-worker is experiencing the same issue, so it's not just me.
Xamarin version: 22.214.171.124
Xamarin Android version: 126.96.36.199
Xamarin iOS version: 188.8.131.529
Which version of the Android SDK Build-tools package do you have installed? Is it 24.*?
Possible workaround: rename your .png files to .PNG, but *not* .9.png files.
rather than manually adding --no-crunch we have a different build property
which you can set. In this case aapt will be run to produce a cache of crunched .png files and only the changes will be crunched after that. So the first build might be slow but following ones should be quick.
The reason the ui looks ugly is because files like 9 patch files (foo.9.png) need to be pre-processed to remove some of the information they contain and other files need to be optimised by the android build system.
Yes, I have 24.0.1 SDK Build-tools.
Thanks for the PNG workaround suggestion, but it seems complicated as we have many .png files in many folders, I think it's not worth the effort.
AndroidExplicitCrunch property works great - the second build is fast and it does not produce ugly UI. Is it safe to set this property to true even for production, release builds?
Still, without using this property, why is aapt.exe called even if I build and deploy iOS only? That is weird. I could add this AndroidExplicitCrunch property even in iOS project configuration, but it does not look like good practice.
AndroidExplicitCrunch should be safe for production/release builds.
I'm not sure why the aapt is being called when you build the iOS project. I would check the solution configuration and make sure that the android project is not set to build when you are targeting iOS.
Its possible that the intellisense build in VS is tripping up the IDE. We have made some changed in the latest stable releases to speed up the intellisense builds and to ensure they do not do work they should not be doing.
If you are still getting issues with aapt locking up the IDE can you provide some diagnostic build logs. This will enable use to see what targets are being run.