Share via


How can I manually install the Android Support libraries required by the Xamarin.Android.Support packages?

Example steps for Xamarin.Android.Support.v4

Download the desired Xamarin.Android.Support NuGet package (for example by installing it with the NuGet package manager).

Use ildasm to check which version of android_m2repository.zip the NuGet package needs:

ildasm /caverbal /text /item:Xamarin.Android.Support.v4 packages\Xamarin.Android.Support.v4.23.4.0.1\lib\MonoAndroid403\Xamarin.Android.Support.v4.dll | findstr SourceUrl

Example output:

property string 'SourceUrl' = string('https://dl-ssl.google.com/android/repository/android_m2repository_r32.zip')
property string 'SourceUrl' = string('https://dl-ssl.google.com/android/repository/android_m2repository_r32.zip')
property string 'SourceUrl' = string('https://dl-ssl.google.com/android/repository/android_m2repository_r32.zip')

Download android_m2repository.zip from Google using the URL returned from ildasm. Alternately, you can check which version of the Android Support Repository you currently have installed in the Android SDK Manager:

"Android SDK Manager showing Android Support Repository version 32 installed"

If the version matches the one you need for the NuGet package, then you don't have to download anything new. You can instead re-zip the existing m2repository directory that is located under extras\android in the SDK Path (as shown the top of the Android SDK Manager window).

Calculate the MD5 hash of the URL returned from ildasm. Format the resulting string to use all uppercase letters and no spaces. For example, adjust the $url variable as needed and then run the following 2 lines (based on the original C# code from Xamarin.Android) in PowerShell:

$url = "https://dl-ssl.google.com/android/repository/android_m2repository_r32.zip"
(([System.Security.Cryptography.MD5]::Create()).ComputeHash([System.Text.Encoding]::UTF8.GetBytes($url)) | %{ $_.ToString("X02") }) -join ""

Example output:

F16A3455987DBAE5783F058F19F7FCDF

Copy android_m2repository.zip into the %LOCALAPPDATA%\Xamarin\zips\ folder. Rename the file to use the MD5 hash from the previous MD5 hash calculating step. For example:

%LOCALAPPDATA%\Xamarin\zips\F16A3455987DBAE5783F058F19F7FCDF.zip

(Optional) Unzip the file into %LOCALAPPDATA%\Xamarin\Xamarin.Android.Support.v4\23.4.0.0\content\ (creating a content\m2repository subdirectory). If you skip this step, then the first build that uses the library will take a little longer because it will need to complete this step. The version number for the subdirectory (23.4.0.0 in this example) is not quite the same as the NuGet package version. You can use ildasm to find the correct version number:

ildasm /caverbal /text /item:Xamarin.Android.Support.v4 packages\Xamarin.Android.Support.v4.23.4.0.1\lib\MonoAndroid403\Xamarin.Android.Support.v4.dll | findstr /C:"string 'Version'"

Example output:

property string 'Version' = string('23.4.0.0')}
property string 'Version' = string('23.4.0.0')}
property string 'Version' = string('23.4.0.0')}

Next Steps

This document discusses the current behavior as of August 2016. The technique described in this document is not part of the stable testing suite for Xamarin, so it could break in the future.

For further assistance, to contact us, or if this issue remains even after utilizing the above information, please see What support options are available for Xamarin? for information on contact options, suggestions, as well as how to file a new bug if needed.