Bug 16043 - Xamarin.Android version 4.64 can't find aapt
Summary: Xamarin.Android version 4.64 can't find aapt
Status: RESOLVED INVALID
Alias: None
Product: Android
Classification: Xamarin
Component: General ()
Version: 4.6.x
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: ---
Assignee: Jonathan Pryor
URL:
Depends on:
Blocks:
 
Reported: 2013-11-08 12:19 UTC by Jon Goldberger [MSFT]
Modified: 2013-11-18 17:59 UTC (History)
2 users (show)

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


Attachments
Verbose build output (73.08 KB, text/plain)
2013-11-17 05:21 UTC, Rhys
Details


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

Comment 1 Jon Goldberger [MSFT] 2013-11-08 12:32:31 UTC
My license has expired for Xamarin.Android / iOS, however I would still like to be able to develop against the version of Xamarin.Android that my license works with.

I can’t seem to find any way to actually do this, if I download Xamarin from my account section, it gets the latest version which only gives me starter edition functionality. If I show all versions and download what seems to be the correct version of both Xamarin Studio and Xamarin.Android from the list and install them on my Mac, the tools appear to be completely broken. Not only can they not locate any of the build tools (fails first with cannot find aapt), but even when symlinking these to where Xamarin expects them to be, it can’t actually link against the Xamarin.Android framework - it falls to find any of the DLLs that wrap the Android SDK.

Can you please instruct me in detail on how to install the software I’ve paid for? It seems the standard path of ‘install and it works’ isn’t actually working now that my plan’s expired.
======================================================
As previously mentioned I’ve already installed this version, and I’ve received issues with Xamarin firstly failing to find the platform tools, and secondly failing to find any of the Xamarin DLLs when linking my application.

I believe this may be due to a fault in the installer, it appears that a command in the postinstall script is faulty:

Nov 4 19:44:01 NeoTop installd[535]: PackageKit: Executing script "./postinstall" in /private/tmp/PKInstallSandbox.MUu6Qd/Scripts/com.xamarin.android.pkg.EBszxg
Nov 4 19:44:01 NeoTop installd[535]: ./postinstall: Usage: javac <options> <source files>
Nov 4 19:44:01 NeoTop installd[535]: ./postinstall: where possible options include:
Nov 4 19:44:01 NeoTop installd[535]: ./postinstall: -g Generate all debugging info
Nov 4 19:44:01 NeoTop installd[535]: ./postinstall: -g:none Generate no debugging info
Nov 4 19:44:01 NeoTop installd[535]: ./postinstall: -g:{lines,vars,source} Generate only some debugging info
Nov 4 19:44:01 NeoTop installd[535]: ./postinstall: -nowarn Generate no warnings
Nov 4 19:44:01 NeoTop installd[535]: ./postinstall: -verbose Output messages about what the compiler is doing
Nov 4 19:44:01 NeoTop installd[535]: ./postinstall: -deprecation Output source locations where deprecated APIs are used
Nov 4 19:44:01 NeoTop installd[535]: ./postinstall: -classpath <path> Specify where to find user class files and annotation processors
Nov 4 19:44:01 NeoTop installd[535]: ./postinstall: -cp <path> Specify where to find user class files and annotation processors
Nov 4 19:44:01 NeoTop installd[535]: ./postinstall: -sourcepath <path> Specify where to find input source files
Nov 4 19:44:01 NeoTop installd[535]: ./postinstall: -bootclasspath <path> Override location of bootstrap class files
Nov 4 19:44:01 NeoTop installd[535]: ./postinstall: -extdirs <dirs> Override location of installed extensions
Nov 4 19:44:01 NeoTop installd[535]: ./postinstall: -endorseddirs <dirs> Override location of endorsed standards path
Nov 4 19:44:01 NeoTop installd[535]: ./postinstall: -proc:{none,only} Control whether annotation processing and/or compilation is done.
Nov 4 19:44:01 NeoTop installd[535]: ./postinstall: -processor <class1>[,<class2>,<class3>...]Names of the annotation processors to run; bypasses default discovery process
Nov 4 19:44:01 NeoTop installd[535]: ./postinstall: -processorpath <path> Specify where to find annotation processors
Nov 4 19:44:01 NeoTop installd[535]: ./postinstall: -d <directory> Specify where to place generated class files
Nov 4 19:44:01 NeoTop installd[535]: ./postinstall: -s <directory> Specify where to place generated source files
Nov 4 19:44:01 NeoTop installd[535]: ./postinstall: -implicit:{none,class} Specify whether or not to generate class files for implicitly referenced files 
Nov 4 19:44:01 NeoTop installd[535]: ./postinstall: -encoding <encoding> Specify character encoding used by source files
Nov 4 19:44:01 NeoTop installd[535]: ./postinstall: -source <release> Provide source compatibility with specified release
Nov 4 19:44:01 NeoTop installd[535]: ./postinstall: -target <release> Generate class files for specific VM version
Nov 4 19:44:01 NeoTop installd[535]: ./postinstall: -version Version information
Nov 4 19:44:01 NeoTop installd[535]: ./postinstall: -help Print a synopsis of standard options
Nov 4 19:44:01 NeoTop installd[535]: ./postinstall: -Akey[=value] Options to pass to annotation processors
Nov 4 19:44:01 NeoTop installd[535]: ./postinstall: -X Print a synopsis of nonstandard options
Nov 4 19:44:01 NeoTop installd[535]: ./postinstall: -J<flag> Pass <flag> directly to the runtime system
Nov 4 19:44:01 NeoTop installd[535]: PackageKit: Writing receipt for com.xamarin.android.pkg to /private/var/db/receipts
Nov 4 19:44:01 NeoTop installd[535]: Installed "Xamarin.Android 4.6.4" ()

I don’t think that the javac command is being used properly as it’s showing the help text. It’s worth noting that xamarin.android finishes installing in a few seconds, I don’t think this is correct.

Can you assist further?
========================================================
Install Log:
I appear to have logs from 3PM this afternoon when originally installing the lower version, but not from my second attempt an hour ago. I’m not sure if they reflect the current issue though:

[2013-11-04 15:19:16.496] [Info] Installation ID: 1400eaa3-da14-4f2e-a6cd-905411a07ecc
[2013-11-04 15:19:16.503] [Info] Operating system: Mac OS X v10.9 (10.9; Mac OS X 10.9 (10.9 build version: 13A603)), 32-bit
[2013-11-04 15:19:16.503] [Info] Installer product: Xamarin
[2013-11-04 15:19:16.503] [Info] Installer version: 3.0.0.36009
[2013-11-04 15:19:16.503] [Debug] Forcing manifest from resources
[2013-11-04 15:19:16.504] [Info] Status: in progress
[2013-11-04 15:19:21.825] [Debug] Waiting for manifests to finish downloading.
[2013-11-04 15:19:21.825] [Debug] Initial task executing (WaitingForActivation). Waiting for it to finish.
[2013-11-04 15:19:22.633] [Info] Retrieving installation manifest.
[2013-11-04 15:19:22.633] [Info] Installation manifest: reading from assembly.
[2013-11-04 15:19:22.634] [Info] Retrieving installation size manifest.
[2013-11-04 15:19:22.634] [Info] Installation size manifest: reading from assembly.
[2013-11-04 15:19:22.634] [Info] Determining list of software items to install.
[2013-11-04 15:19:22.634] [Debug] Processing update nodes from the manifest.
[2013-11-04 15:19:22.634] [Debug] Creating and initializing software item 'Mono Framework'
[2013-11-04 15:19:22.942] [Debug] Creating and initializing software item 'Java SDK'
[2013-11-04 15:19:22.942] [Debug] Creating and initializing software item 'Android SDK'
[2013-11-04 15:19:22.943] [Debug] Creating and initializing software item 'Xamarin Studio'
[2013-11-04 15:19:22.943] [Debug] Creating and initializing software item 'Xamarin.Android'
[2013-11-04 15:19:22.943] [Debug] Creating and initializing software item 'Xamarin.iOS'
[2013-11-04 15:19:22.943] [Debug] Detecting software item 'Mono Framework'
[2013-11-04 15:19:22.943] [Info] Checking whether Mono needs update/installation
[2013-11-04 15:19:22.943] [Info] Mono runtime found in /Library/Frameworks/Mono.framework/Versions/3.2.0
[2013-11-04 15:19:22.943] [Info] Mono version 3.2.0 was found in /Library/Frameworks/Mono.framework/Versions
[2013-11-04 15:19:23.044] [Info] Status: successful
[2013-11-04 15:19:23.044] [Info] Component 'Mono Framework' v. 3.2.0 present
[2013-11-04 15:19:23.046] [Info] Software item 'Mono Framework': up to date
[2013-11-04 15:19:23.046] [Debug] Detecting software item 'Java SDK'
[2013-11-04 15:19:23.046] [Info] Checking whether Mac JDK needs update/installation
[2013-11-04 15:19:23.046] [Info] Status: successful
[2013-11-04 15:19:23.046] [Info] Component 'Java SDK' v. 1.6.0 present
[2013-11-04 15:19:23.047] [Info] Software item 'Java SDK': up to date
[2013-11-04 15:19:23.047] [Debug] Detecting software item 'Android SDK'
[2013-11-04 15:19:23.047] [Info] Checking if Android SDK needs to be updated/installed
[2013-11-04 15:19:23.047] [Info] Fetching Android SDK manifest.
[2013-11-04 15:19:23.047] [Info] Manifest URL: http://dl.google.com/android/repository/repository-8.xml
[2013-11-04 15:19:23.047] [Info] Using default samples:
[2013-11-04 15:19:23.047] [Info] Downloading from 'http://dl.google.com/android/repository/repository-8.xml'.
[2013-11-04 15:19:23.047] [Debug] Setting download timeout for 'http://dl.google.com/android/repository/repository-8.xml' to 25s
[2013-11-04 15:19:23.149] [Info] AVD 'MonoForAndroid API 15' needs to be created.
[2013-11-04 15:19:23.149] [Info] AVD 'MonoForAndroid API 14' needs to be created.
[2013-11-04 15:19:23.149] [Info] AVD 'MonoForAndroid API 12' needs to be created.
[2013-11-04 15:19:23.149] [Info] AVD 'MonoForAndroid API 10' needs to be created.
[2013-11-04 15:19:23.150] [Info] AVD 'MonoForAndroid API 8' needs to be created.
[2013-11-04 15:19:23.150] [Info] AVD 'MonoForAndroid API 7' needs to be created.
[2013-11-04 15:19:23.251] [Info] Determining the list of components to install/update in /Users/Rhys/Documents/Development/adt/sdk
[2013-11-04 15:19:23.251] [Info] Checking Platform Tools component.
[2013-11-04 15:19:23.252] [Info] Platform Tools need to be installed.
[2013-11-04 15:19:23.252] [Info] Checking Tools component.
[2013-11-04 15:19:23.252] [Info] Tools need to be installed.
[2013-11-04 15:19:23.262] [Info] Checking Build Tools component.
[2013-11-04 15:19:23.262] [Info] Checking API 7
[2013-11-04 15:19:23.262] [Warning] System image descriptor for API level 7 is missing
[2013-11-04 15:19:23.262] [Info] Checking API 8
[2013-11-04 15:19:23.262] [Warning] System image descriptor for API level 8 is missing
[2013-11-04 15:19:23.263] [Info] Checking API 10
[2013-11-04 15:19:23.263] [Warning] System image descriptor for API level 10 is missing
[2013-11-04 15:19:23.263] [Info] Checking API 12
[2013-11-04 15:19:23.263] [Warning] System image descriptor for API level 12 is missing
[2013-11-04 15:19:23.263] [Info] Checking API 14
[2013-11-04 15:19:23.263] [Info] Checking API 15
[2013-11-04 15:19:23.264] [Info] Checking NDK
[2013-11-04 15:19:23.264] [Debug] Download size for 'http://dl.google.com/android/ndk/android-ndk-r8d-darwin-x86.tar.bz2': 308328942
[2013-11-04 15:19:23.264] [Debug] NDK found in '/Users/Rhys/Library/Developer/Xamarin/android-ndk/android-ndk-r8d', no update necessary
[2013-11-04 15:19:23.264] [Info] Android SDK needs to be updated/installed
[2013-11-04 15:19:23.264] [Info] Asking user to select the Android SDK to update
[2013-11-04 15:19:23.264] [Info] Status: successful
[2013-11-04 15:19:23.264] [Info] Software item 'Android SDK': not up to date
[2013-11-04 15:19:23.264] [Info] Component 'Android SDK' v. 22.2.1 present but requires update to v. 22.0.0
[2013-11-04 15:19:23.265] [Debug] Detecting software item 'Xamarin Studio'
[2013-11-04 15:19:23.265] [Info] Checking whether Xamarin Studio needs installation/updating
[2013-11-04 15:19:23.265] [Info] Xamarin Studio installation check: app directory does not exist.
[2013-11-04 15:19:23.265] [Info] Xamarin Studio not detected.
[2013-11-04 15:19:23.265] [Info] Xamarin Studio 4.0.10 needs to be installed.
[2013-11-04 15:19:23.265] [Info] Status: successful
[2013-11-04 15:19:23.266] [Info] Software item 'Xamarin Studio': not up to date
[2013-11-04 15:19:23.266] [Info] Component 'Xamarin Studio' v. 4.0.10 absent
[2013-11-04 15:19:23.266] [Debug] Detecting software item 'Xamarin.Android'
[2013-11-04 15:19:23.266] [Info] Checking whether Xamarin.Android SDK needs installation/updating
[2013-11-04 15:19:23.871] [Info] Status: successful
[2013-11-04 15:19:23.876] [Info] Component 'Xamarin.Android' v. 4.8.0 present
[2013-11-04 15:19:23.882] [Info] Software item 'Xamarin.Android': up to date
[2013-11-04 15:19:23.888] [Debug] Detecting software item 'Xamarin.iOS'
[2013-11-04 15:19:23.894] [Info] Checking whether Xamarin.iOS needs update/installation
[2013-11-04 15:19:23.899] [Info] Status: successful
[2013-11-04 15:19:23.905] [Info] Component 'Xamarin.iOS' v. 6.4.0 present
[2013-11-04 15:19:23.911] [Info] Software item 'Xamarin.iOS': up to date
[2013-11-04 15:19:23.917] [Info] Detection complete
[2013-11-04 15:19:23.922] [Info] Initial task completed successfully
[2013-11-04 15:19:23.928] [Debug] Detection complete on the introduction page, determining the next step.
[2013-11-04 15:19:27.861] [Info] Done. All steps not completed. Failure: False; Status: Successful
[2013-11-04 15:19:27.861] [Info] Status: successful
[2013-11-04 15:19:27.863] [Info] Status: aborted by user
[2013-11-04 15:19:27.863] [Info] Status: completed

This log is from ~/Library/Logs/XamarinInstaller/Universal.

Xamarin Studio when going to About reports its version as 4.0.6, Xamarin.Android is reported as 4.6.4.
========================================================
Here’s the full build log demonstrating Xamarin being unable to find the ‘aapt’ tool:


Building Solution: testxam (Debug)

Building: testxam (Debug)

Build started 06/11/2013 06:48:35.
__________________________________________________
Project "/Users/Rhys/Desktop/testxam/testxam/testxam.csproj" (Build target(s)):
	
	Target _CheckProjectItems:
		CheckProjectItems Task
		  NativeLibraries:
		  JavaLibraries:
		  JavaSourceFiles:
	
	Target _ComputeAndroidAssetsPaths:
		  ResourceFiles:
		  IntermediateFiles:
	
	Target _GenerateAndroidAssetsDir:
	No output files were specified for target _GenerateAndroidAssetsDir, skipping.
	
	Target _ComputeAndroidResourcePaths:
		  ResourceFiles:
		    Resources/layout/Main.axml
		    Resources/values/Strings.xml
		    Resources/drawable/Icon.png
		  IntermediateFiles:
	
	Target _ResolveMonoAndroidSdks:
		MonoAndroid Tools: /Library/Frameworks/Xamarin.Android.framework/Versions/Current/lib/mandroid/
		MonoAndroid Framework: /Library/Frameworks/Xamarin.Android.framework/Versions/Current/lib/mandroid/platforms/android-8;/Library/Frameworks/Xamarin.Android.framework/Versions/Current/lib/mono/2.1
		MonoAndroid Binaries: /Library/Frameworks/Xamarin.Android.framework/Versions/Current/bin/
		Android NDK: /Users/Rhys/Library/Developer/Xamarin/android-ndk/android-ndk-r8d
		Android SDK: /Users/Rhys/Downloads/android-sdk-macosx/
		Java SDK: /usr/
	
	Target _ValidateAndroidPackageProperties:
		GetAndroidPackageName Task
		  ManifestFile: /Users/Rhys/Desktop/testxam/testxam/Properties/AndroidManifest.xml
		  AssemblyName: testxam
		  PackageName: testxam.testxam
	
	Target _BuildDependencies:
		Resolved library outputs: 
	
	Target _ExtractLibraryProjectImports:
		  Assemblies: 
		    /Library/Frameworks/Xamarin.Android.framework/Versions/Current/lib/mono/2.1/System.dll
		    /Library/Frameworks/Xamarin.Android.framework/Versions/Current/lib/mono/2.1/System.Xml.dll
		    /Library/Frameworks/Xamarin.Android.framework/Versions/Current/lib/mandroid/platforms/android-8/Mono.Android.dll
		    /Library/Frameworks/Xamarin.Android.framework/Versions/Current/lib/mono/2.1/System.Core.dll
		  Jars: 
		  ResolvedResourceDirectories: 
	
	Target _GetLibraryImports:
		  NativeLibraries: 
		  Jars: 
	
	Target _CheckDuplicateJavaLibraries:
		  JavaSourceFiles:
		  JavaLibraries:
	
	Target _UpdateAndroidResgen:
		  AdditionalResourceDirectories: 
		Tool /Users/Rhys/Downloads/android-sdk-macosx/platform-tools/aapt execution started with arguments: package -f -m -M /var/folders/l8/hpjklr6d4ms1fjq0lc125sf00000gn/T/vdafu3x5.9tk/AndroidManifest.xml -J /var/folders/l8/hpjklr6d4ms1fjq0lc125sf00000gn/T/vdafu3x5.9tk --custom-package testxam.testxam -F /var/folders/l8/hpjklr6d4ms1fjq0lc125sf00000gn/T/vdafu3x5.9tk/resources.apk.bk -S obj/Debug/res/ -I /Users/Rhys/Downloads/android-sdk-macosx/platforms/android-16/android.jar --auto-add-overlay 
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets: error : Error executing tool '/Users/Rhys/Downloads/android-sdk-macosx/platform-tools/aapt': ApplicationName='/Users/Rhys/Downloads/android-sdk-macosx/platform-tools/aapt', CommandLine='package -f -m -M /var/folders/l8/hpjklr6d4ms1fjq0lc125sf00000gn/T/vdafu3x5.9tk/AndroidManifest.xml -J /var/folders/l8/hpjklr6d4ms1fjq0lc125sf00000gn/T/vdafu3x5.9tk --custom-package testxam.testxam -F /var/folders/l8/hpjklr6d4ms1fjq0lc125sf00000gn/T/vdafu3x5.9tk/resources.apk.bk -S obj/Debug/res/ -I /Users/Rhys/Downloads/android-sdk-macosx/platforms/android-16/android.jar --auto-add-overlay ', CurrentDirectory='/Users/Rhys/Desktop/testxam/testxam', Native error= Cannot find the specified file
	Task "Aapt" execution -- FAILED
	Done building target "_UpdateAndroidResgen" in project "/Users/Rhys/Desktop/testxam/testxam/testxam.csproj".-- FAILED
	
Done building project "/Users/Rhys/Desktop/testxam/testxam/testxam.csproj".-- FAILED

Build FAILED.
Errors:

/Users/Rhys/Desktop/testxam/testxam/testxam.csproj (Build) ->
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets (_UpdateAndroidResgen target) ->

	/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets: error : Error executing tool '/Users/Rhys/Downloads/android-sdk-macosx/platform-tools/aapt': ApplicationName='/Users/Rhys/Downloads/android-sdk-macosx/platform-tools/aapt', CommandLine='package -f -m -M /var/folders/l8/hpjklr6d4ms1fjq0lc125sf00000gn/T/vdafu3x5.9tk/AndroidManifest.xml -J /var/folders/l8/hpjklr6d4ms1fjq0lc125sf00000gn/T/vdafu3x5.9tk --custom-package testxam.testxam -F /var/folders/l8/hpjklr6d4ms1fjq0lc125sf00000gn/T/vdafu3x5.9tk/resources.apk.bk -S obj/Debug/res/ -I /Users/Rhys/Downloads/android-sdk-macosx/platforms/android-16/android.jar --auto-add-overlay ', CurrentDirectory='/Users/Rhys/Desktop/testxam/testxam', Native error= Cannot find the specified file

	 0 Warning(s)
	 1 Error(s)

Time Elapsed 00:00:00.2284480

---------------------- Done ----------------------

Build: 1 error, 0 warnings

It’s only by copying the files it complains about from version 17 of the SDK does compilation actually succeed. I’m not getting the issues with references this time around though.

=================================================
Comment 2 Jonathan Pryor 2013-11-15 15:50:06 UTC
> Not only can they not locate any of the build tools (fails first with cannot find aapt),

I think it may be too much to expect older versions to work when Google changes the location of many tools...

I do attempt to make things more resilient/flexible as time goes forward. For example, in recent versions, it should be possible to set the $(AaptToolPath) MSBuild property to override the `aapt` location:

    xbuild /p:AaptToolPath=/path/to/new/aapt ...

However, I don't know which version that behavior was added in. It's probably 4.8+...

> I don’t think that the javac command is being used properly as it’s showing the

`javac` is being used properly. The intent of invoking javac in the installer is _not_ to compile Java code; the intent is to provoke OS X to run the Java 1.6 SDK installer if Java is not already installed on your machine. (You'll need a "clean" OS X machine to fully see this behavior. `javac` exists, but executing it doesn't run the java compiler, as the JDK isn't installed; instead, running javac will show a GUI dialog saying "Do you want to install Java?".)

> but even when symlinking these to where Xamarin expects them to be, it can’t actually
> link against the Xamarin.Android framework

That I would consider to be a bug. Unfortunately, none of the output you provided shows the errors you get when attempting to link against the Xamarin.Android framework.

Could you please attach diagnostic build output of a failing build?
Comment 3 Rhys 2013-11-17 05:21:50 UTC
Created attachment 5458 [details]
Verbose build output
Comment 4 Rhys 2013-11-17 05:23:44 UTC
I think it isn't too much to expect when these are the only version of the tools that Google offers and you charge for upgrades... It'd be a different story if Google offered legacy versions of the tools but that's not the case.

I've attached the diagnostics build output as requested.
Comment 5 Jonathan Pryor 2013-11-18 17:59:40 UTC
The problem is:

> 	Error: Unable to access jarfile /Developer/SDKs/android-sdk-macosx/platform-tools/lib/dx.jar

It looks like your symlinks were incomplete. You not only need to symlinks `aapt`, but you also need to symlink `build-tools/*/lib` into `platform-tools/lib`

http://forums.xamarin.com/discussion/comment/13817/#Comment_13817

mkdir -p /Developer/SDKs/android-sdk-macosx/platform-tools
if [ -d /Developer/SDKs/android-sdk-macosx/platform-tools/lib ] ; then
    mv /Developer/SDKs/android-sdk-macosx/platform-tools/lib /Developer/SDKs/android-sdk-macosx/platform-tools/_lib
fi
ln -s \
/Developer/SDKs/android-sdk-macosx/build-tools/*/lib \
/Developer/SDKs/android-sdk-macosx/platform-tools/lib

(May fail if you have more than one build-tools directory. Fix as appropriate.)