mathkid91
mathkid91

Reputation: 679

Xamarin in VS - Unable to install Android Support v4

I installed Visual Studio 2015 to try out Xamarin that comes with the community version, but I have not been able to open a single project. I have downloaded a few projects from GitHub that I want to try out, but they all get the same error. First, it says I am missing a reference/assembly, and I figured this was the Xamarin.Android.Support.v4. So I downloaded this from Xamarin's website and added it to the project. This somewhat worked, however every time I try to build my project, I get an error:

NuGet Package restore failed for project AndroidAltBeaconLibrary.Sample: Unable to find version '21.0.3' of package 'Xamarin.Android.Support.v4'.

This error seems to haunt me whatever I try to do. When I open my NuGet manager, I am not able to do anything, as this error pops up here as well (I wanted to try remove the NuGet and add it again). It just says Xamarin.Android.Support.v4 is installed (but not available in this source) regardless of if I remove it from References.

Does anyone have any tips of what to do??

Edit: I forgot to mention, the version I downloaded is 23.1.1.1

Edit 2: Using the install command does not work in the projects. An error says it needs to restore NuGet packages first, however it is not able to do this either. In a blank project, it is not able to find this NuGet (neither 23.1.1.1 nor 21.0.3.. In fact, when I open NuGet manager, it is not able to find any NuGets at all in the Browse Tab. Is my VS just messed up? Should I reinstall the whole thing??

Upvotes: 0

Views: 3194

Answers (2)

David Riha
David Riha

Reputation: 1436

I have trouble restoring Xamarin.Android.Support nugets too. This solved my issue:

1) allow nuget restore on build (Tools > NuGet Package Manager > Package Manager Settings)

2) remove the reference from .csproj file:

<Reference Include="Xamarin.Android.Support.v4, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
  <HintPath>..\packages\Xamarin.Android.Support.v4.23.3.0\lib\MonoAndroid403\Xamarin.Android.Support.v4.dll</HintPath>
  <Private>True</Private>
</Reference>

3) rebuild all (ignore errors, restore will still work)

4) put the reference back to .csproj file

5) rebuild and it should be OK

Upvotes: 2

Luis Beltran
Luis Beltran

Reputation: 1704

You need to use the specific 21.0.3 version of Xamarin.Android.Support.v4, which Xamarin uses.

Install it from NuGet

Upvotes: 0

Related Questions