简体   繁体   中英

Visual Studio 2015 - Adding Android Support Library v4 and v7 to use DrawerLayout and ActionBarDrawerToggle

I am trying to add these 2 support libraries to my project through Nuget Manager in Visual Studio in order to be able to use DrawerLayout and ActionBarDrawerToggle . However, both libraries are failing to install with the same error:

*****Could not install package 'Xamarin.Android.Support.Compat 24.2.1'. You are trying to install this package into a project that targets '.NETFramework,Version=v4.5', 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.***** (the screenshot of the error is also provided at the bottom)

Below are screenshots for these 2 libraries as shown in VS2015 Nuget Package Manager:

Xamarin.Android.Support.v4

在此处输入图片说明

Xamarin.Android.Support.v7.AppCompat v 24.2.1

在此处输入图片说明

I have installed SDK Platforms in my Android SDK Manager from API19 to API25 and in Extras, I have both Android Support Repository and Android Support Library as can be seen below: 在此处输入图片说明

And I have installed Android SDK Tools, Platform-tools and Build-tools from 19 to 25.2.2:

在此处输入图片说明

Once I select to install these 2 libraries to my project and hit OK on Review Changes dialog and Licence Acceptance dialog, the installation fails with error like below:

在此处输入图片说明

The Xamarin.Android.Support.Compat 24.2.1 NuGet package contains assemblies for MonoAndroid v7.0. So you will need to change the target framework of your Android project to be 7.0. You should be able to change that in the Visual Studio project options.

You may need to update your Android SDKs if v7.0 is not available.

See also this forums post .

看来我所需要做的就是重新启动Visual Studio。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM