3

I get a aapt.exe exited with code 1073741819 error when I try to build a new blank android app in VS2015 Community Edition. Also a file obj\android\bin\packaged_resources does not exist error. I have changed nothing and this happens.

I've tried looking this up and have found about:

  • Changing the output verbosity to Diagnostic [Doing this has not yielded anything useful that I can understand]
  • Ensuring all concerned files and directories contain no spaces or any special characters/symbols.
  • Installing all the latest Android SDKs.

The solutions I've been able to find (which usually include checking names of files and directories along with re-installing Visual Studio all together) do not resolve the issue. I have also tried Repairing VS to no avail as well as re-running the Xamarin for VS installer which also had no effect.

I would rather leave re-installing VS entirely as a last resort since it is a large download (+20GB).

-EDIT-

Most threads I've looked up talk about resolving erroneous syntax, missing parameters, calls to variables that were not declared, incorrect id tags, spaces or dashes in filenames etc. All usually in xml or layout files.

That is not the case for me. I get these errors as soon as I create a new project. I've checked the default code and it does not seem to have any errors in and of itself.

What is also a common remedy is to set output verbosity to 'normal' or 'diagnostic'as doing that would usually point out the culprit (often a syntax error). This has not worked for me either

Also I am up-to-date with SDK packages.

Daniele D.
  • 2,624
  • 3
  • 36
  • 42
OZYMANDIAS
  • 31
  • 5
  • 3
    Possible duplicate of [AAPT failing with error code -1073741819](http://stackoverflow.com/questions/10699439/aapt-failing-with-error-code-1073741819) – SushiHangover Apr 29 '16 at 13:33
  • 1
    Most (All?) of the causing concerning aapt failures on Windows are related to the SDK version of the Android build tools and/or `id` of styles in `styles.xml` http://stackoverflow.com/questions/15972970/aapt-crashes-after-added-facebook-sdk-3-0-as-library , http://stackoverflow.com/questions/10699439/aapt-failing-with-error-code-1073741819 , etc.. – SushiHangover Apr 29 '16 at 13:38
  • @SushiHangover I have just gone through those threads. I'm not sure if there are any differences between IntelliJ and Xamarin for VS when it comes to developing Android apps but anyway The solutions in that thread are about linking an external library and resolving conflicting or duplicate id tags and general incorrect syntax in layout or xml files (removing "@+id" from all id's). I doubt this is the case for me as this error appears as soon as I create a new project so it can't be the fault of id tags. I have downloaded everything that can be downloaded from the SDK manager. – OZYMANDIAS Apr 29 '16 at 20:15
  • Which version of the Android SDK **build-tools** are you using? (23.0.?) – SushiHangover Apr 29 '16 at 20:21
  • The latest version of the SDK build-tools I have is 23.0.3 – OZYMANDIAS Apr 29 '16 at 20:28
  • I would try setting it to `23.0.2` and retry, if it fails, try `22.0.1`. This is set via the MSBuild parameter `AndroidSdkBuildToolsVersion` – SushiHangover Apr 29 '16 at 20:32
  • Right so simply deleting where these build tool versions were located didn't fix the issue. In fact my project ended up telling me it couldn't find the 24.0.0 preview aapt executable Googling anything pertaining to the androidsdkbuildtoolsversion or the msbuild tools or setting the build tools of a vs project has not yielded anything useful. I haven't been able to find where I can adjust this parameter in the project's properties, manifest file or any other associated file So I am asking how exactly does one force the project to use an older version or set the parameter to an older version – OZYMANDIAS May 01 '16 at 15:27
  • goto https://developer.xamarin.com/guides/android/under_the_hood/build_process/ and search the page for `AndroidSdkBuildToolsVersion` These are MSBuild properties so you can define them in your `.csproj` file. – SushiHangover May 01 '16 at 15:31

3 Answers3

1

Remove SDK 24 using the Android SDK Manager. Technote on this exact issue here - https://releases.xamarin.com/technical-bulletin-android-sdk-build-tools-24/ . Totally removing "24" from my machine cleared it. Just changing targets did not.

Joe Healy
  • 5,769
  • 3
  • 38
  • 56
  • I had to remove *SDK Platform* for *Android 8.0.0 (API 26)*. Now my simulator works again (before aapt.exe crashed on build). – testing Jul 25 '17 at 11:09
0

From android SDK manager just make sure that at least one Android SDK Build Tools for your used API is installed

for example for version 22.0.1 , check the below image

enter image description here

Iman
  • 17,932
  • 6
  • 80
  • 90
0

I know this question is ancient, but I stumbled on it earlier today with a nearly identical problem. The answers and comments got me nearly all the way to a solution, and since this never seemed to wrap up neatly I thought someone might benefit from my flailing.

I'm pretty new to Xamarin and most other things programming and this is my first Stack answer, so my apologies in advance if I'm off base or out of bounds with anything.

Since it appeared at least some of the problem is conflicting APIs, I set the properties of the application to Android 6.0 (API 23) for compiling and targeting to simplify troubleshooting. See this screencap. This eliminated one instance of code 1073741819 right off the bat.

I then deleted everything that wasn't related to API 23 or Android 6.0 via the SDK manager. Including, rookie mistake, Android SDK Tools in the tools folder. The solution compiled error free (yay!) but my Android tools were gone...something I didn't notice until I tried to get a list of packages from the SDK Manager (that was no longer functional).

I ended up downloading a new set of command line tools from Android and placing the extracted "Tools" folder back into ProgramFiles(x86)\Android\android-sdk. This fixed my mistake with SDK Tools, and added additional packages to my "API 23 only" lineup--but the solution still builds error free.

I currently have the below packages installed per the Android SDK manager and solution builds as expected, so one can use the SDK Manager to modify the packages instead of doing full removal and reinstall of the tools folder (like I bumbled into).

  • Tools
    • Android SDK Tools : Rev 25.2.3
    • Android SDK Build-tools : Rev 23.0.3
    • Android SDK Build-tools : Rev 23.0.2
    • Android SDK Build-tools : Rev 23.0.1
    • Android SDK Build-tools : Rev 22.0.1
    • Android SDK Build-tools : Rev 21.1.21
  • Android 7.1.1 (API 25)
    • Sources for Android SDK : API 25 Rev 1
  • Android 6.0 (API 23)
    • SDK Platform : API 23 Rev 3
    • Google APIs : API 23 Rev 1
    • Google APIs ARM EABI v7a System Image : API 23 Rev 7
    • Google APIs Intel x86 Atom System Image : API 23 Rev 12
    • Sources for Android SDK : API 23 Rev 1

tl/dr:

The wrong combo of Android APIs installed seem to break the aapt.exe process, as does targeting/compiling in a version you don't have packages for or have conflicting packages for.

  1. Setting application properties to a single desired Android version, and
  2. replacing the ProgramFiles(x86)\android-sdk\tools folder with the latest download of command line tools from Android allowed it to build error free.
jdmac020
  • 557
  • 1
  • 5
  • 18