locked
NuGet error updating Xamarin.Android.Support.v7.AppCompat 21.0.0.0 RRS feed

  • Question

  • User54912 posted

    Hello! I've noticed that Xamarin updated android support libraries bindings in NuGet repo to 21.0.0.0 release version yesterday. Now I'm trying to update references in my Visual Studio Xamarin project to the last version. https://www.nuget.org/packages/Xamarin.Android.Support.v7.AppCompat/ But while updating Package Manager Console tells me that something is wrond with my project.

    PM> Install-Package Xamarin.Android.Support.v7.AppCompat Attempting to resolve dependency 'Xamarin.Android.Support.v4 (= 21.0.0.0)'. Installing 'Xamarin.Android.Support.v7.AppCompat 21.0.0.0'. Successfully installed 'Xamarin.Android.Support.v7.AppCompat 21.0.0.0'. Adding 'Xamarin.Android.Support.v7.AppCompat 21.0.0.0' to .... Uninstalling 'Xamarin.Android.Support.v7.AppCompat 21.0.0.0'. Successfully uninstalled 'Xamarin.Android.Support.v7.AppCompat 21.0.0.0'. Install failed. Rolling back... Install-Package : Could not install package 'Xamarin.Android.Support.v7.AppCompat 21.0.0.0'. You are trying to install this package into a project that targets 'MonoAndroid,Version=v2.2', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author. At line:1 char:1 + Install-Package Xamarin.Android.Support.v7.AppCompat + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [Install-Package], InvalidOperationException + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.InstallPackageCommand Meawhile, actulally I has such properties:

    Could anyone please help to unerstand what does that mean? And especially "You are trying to install this package into a project that targets 'MonoAndroid,Version=v2.2" string.

    Tuesday, December 9, 2014 6:08 PM

All replies

  • User18049 posted

    NuGet looks at your project's target framework and version to see if the NuGet packages are compatible. As far as NuGet is aware your project is targeting MonoAndroid version 2.2

    Looking at the screenshot that should map to what you have selected in Compile using Android version. However that does not seem to match since you have Android 5.0 installed.

    I would check your .csproj and see what is in that file. Then you can either change it manually or use the drop down to explicitly pick a target framework instead of using the latest to see if that fixes it.

    Tuesday, December 9, 2014 6:57 PM
  • User78508 posted

    @mattward? same problem here can you please guide me, How can i add v7 support library to my app, because i want implement material design in my app,

    this is my .csproj

    <?xml version="1.0" encoding="utf-8"?> <Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <PropertyGroup> <ProjectView>ShowAllFiles</ProjectView> <AndroidDesignerPreferredDevice>Nexus 4</AndroidDesignerPreferredDevice> </PropertyGroup> </Project>

    Monday, December 15, 2014 5:31 AM
  • User78508 posted

    hi @PavelIvanov did you resolve your problem can you please guide me

    Monday, December 15, 2014 5:32 AM
  • User18049 posted

    @Manikandan.5390 - What error are you seeing? What is the TargetFrameworkVersion in your project file (.csproj)?

    <TargetFrameworkVersion>v5.0</TargetFrameworkVersion>
    
    Monday, December 15, 2014 9:23 AM
  • User18686 posted

    Same problem for me, in the packages.config file, all packages have targetFramework="MonoAndroid22", I'll try reinstalling all packages to see if it fixes the issue. I don't think the android target version is saved in the csproj, it doesn't change when I switch to another version. (just checked, the TargetFrameworkVersion is empty in my csproj)

    Tuesday, December 16, 2014 1:17 PM
  • User18686 posted

    Tried to set the TargetFrameworkVersion to v2.3, v4.0, not working, It installs when set to v5.0. Need to reinstall all other packages now I guess.

    Tuesday, December 16, 2014 1:31 PM
  • User18049 posted

    The TargetFrameworkVersion should be updated by Visual Studio if you change the selected API level to something other than Use Latest Platform in the Compile using Android Version from the project Properties. If that is not working can you file a bug on bugzilla with your Xamarin setup information?

    Tuesday, December 16, 2014 1:54 PM
  • User18686 posted

    I was playing with "Minimum Android to target" and "Target Android version", that's why I didn't see it changing.

    So is that a bug that the value is empty when "Use Latest Platform" is used in "Compile using Android version:"? Nuget seems to think the version is v2.2 by default.

    Tuesday, December 16, 2014 2:05 PM
  • User18049 posted

    The names are perhaps a bit confusing :)

    NuGet uses the TargetFrameworkVersion defined by the project when checking if a NuGet package is compatible. This is set by the Compile using Android version drop down and not the Target Android version.

    If there is no TargetFrameworkVersion defined in your project then the Xamarin Android MSBuild targets default to returning version 2.2

    At compile time the Xamarin Android MSBuild targets may well be using the latest platform available but from NuGet and Visual Studio's point of view the target framework version will be 2.2 if none is specified or whatever is in the project file.

    Xamarin Studio has different behaviour to Visual Studio since it will add the TargetFrameworkVersion to your project and use the latest version available on your machine. Not sure which IDE is using the better approach here :)

    Tuesday, December 16, 2014 2:32 PM
  • User43648 posted

    Same problem here. My settings are:

    Compile using android version: "use latest platform (android 21)"

    Minimum Android to target: "Api level 14"

    Target Android version: "use compile version"

    In the csproj file there isn't a TargetFrameworkVersion tag. How can I resolve this issue?

    Friday, January 23, 2015 11:48 AM
  • User18049 posted

    If you are using Visual Studio then you may be running into a bug where the TargetFrameworkVersion is cleared if you are compiling using the latest platform.

    You could try adding the TargetFrameworkVersion element to your .csproj manually or change the Compile using android version setting so it targets a particular Android version temporarily.

    Friday, January 23, 2015 1:03 PM
  • User54912 posted

    Finally first mattward's advice was helpful. Setting to v5.0 fixed issue. Or try to set value to certain framework version in settings.

    Tuesday, February 3, 2015 5:00 PM
  • User87015 posted

    @PavelIvanov that allowed installing it but when I try to build I get the following errors:

    Unzipping failed. Please download https://dl-ssl.google.com/android/repository/androidm2repository_r10.zip and extract it to the C:\Users\Ertay\AppData\Local\Xamarin\Android.Support.v7.AppCompat\21.0.3\content directory.

    Reason: C:\Users\Ertay\AppData\Local\Xamarin\Android.Support.v7.AppCompat\21.0.3\androidm2repositoryr10.zip is not a valid zip file

    Please install package: 'Android Support Library' available in SDK installer. Java library file C:\Users\Ertay\AppData\Local\Xamarin\Android.Support.v7.AppCompat\21.0.3\embedded\classes.jar doesn't exist.

    Unzipping failed. Please download https://dl-ssl.google.com/android/repository/androidm2repositoryr10.zip and extract it to the C:\Users\Ertay\AppData\Local\Xamarin\Android.Support.v7.AppCompat\21.0.3\content directory.

    Reason: C:\Users\Ertay\AppData\Local\Xamarin\Android.Support.v7.AppCompat\21.0.3\androidm2repositoryr10.zip is not a valid zip file

    Please install package: 'Android Support Library' available in SDK installer. Android resource directory C:\Users\Ertay\AppData\Local\Xamarin\Android.Support.v7.AppCompat\21.0.3\embedded./ doesn't exist.

    This is very frustrating.

    Wednesday, February 4, 2015 9:31 PM
  • User87015 posted

    Apparently my .zip file was corrupted. But just replacing it didn't fix the issue, VS started freezing during the build process and java.exe spiked to 100% cpu usage. To fix this, I updated from JDK 1.7 to JDK 1.8 (x64).

    Thursday, February 5, 2015 12:51 AM
  • User50706 posted

    Setting the TargetFrameworkVersion worked for me. Steps :

    1. Unload Android Project
    2. Edit .csproject
    3. Add %Whatever version you want to target% Example : v4.1
    4. Reload project
    5. Re-add nuget package
    Sunday, February 15, 2015 11:36 PM
  • User101859 posted

    Hi,

    the suggestion worked for me: I edited the .proj file for Android and changed this line to the target API version in the AndroidManifest.xml: <TargetFrameworkVersion>*your value here*</TargetFrameworkVersion>

    To this line: <TargetFrameworkVersion>v4.0.3</TargetFrameworkVersion>

    Wednesday, March 4, 2015 3:34 PM
  • User26934 posted

    Downloading the zip to where the error message said fixed this for me

    Friday, March 20, 2015 5:50 AM
  • User101576 posted

    Like @PavelIvanov said, the solution presented by @mattward was helpful to resolve this issue \o/

    Thursday, April 16, 2015 3:45 PM
  • User57618 posted

    PaulP steps helped - mine is working now.

    Wednesday, June 10, 2015 6:37 AM
  • User108159 posted

    the path to zip is showing wrong to me when I try build using jenkins + msbuild - "C:\windows\system32\config\systemprofile\AppData\Local\Xamarin\Android.Support.v4\22.2.1" where as its actually in "C:\Users\Username\AppData\Local\Xamarin\Android.Support.v4\22.2.1"

    From where I can change this path ?? Do anyone have any Idea...

    Wednesday, September 23, 2015 7:55 AM
  • User232764 posted

    https://forums.xamarin.com/discussion/58053/google-maps-xamarin-android-support-v4

    Thursday, June 30, 2016 10:32 PM