xamarin / AndroidSupportComponents

Xamarin bindings for Android Support libraries - For AndroidX see https://github.com/xamarin/AndroidX
MIT License
146 stars 56 forks source link

Xamarin.Android.Support.v7.AppCompat v27.xxxxx will not install or update #93

Closed OladotunO closed 6 years ago

OladotunO commented 6 years ago

Hi Guys

I have been struggling to instal Xamarin.Android.Support.v7.AppCompat v27.xx on a blank android project in Visual studio 2017 via the nuget package installer. Afterall, I had done so only a few days ago and on many other projects.

So I gave up, and looked at the other projects, then tried to update them, and they fail to update. V26.1.0.1 installs and is the last working one for me.

Is this a bug or has something changed ?

Cheers

BoogieMAN2K commented 6 years ago

The last update screw ups my project too, I need to install a package which has a dependency with Xamarin.Android.Support.v7.AppCompat and it's failing because of this:

Could not install package 'Xamarin.Android.Support.Design 27.0.2'. You are trying to install this package into a project that targets 'MonoAndroid,Version=v8.0'

NoleHealth commented 6 years ago

Same here Package Xamarin.Android.Support.v7.AppCompat 27.0.2 is not compatible with monoandroid80 (MonoAndroid,Version=v8.0). Package Xamarin.Android.Support.v7.AppCompat 27.0.2 supports: monoandroid81 (MonoAndroid,Version=v8.1)

I manually ran Visual Studio Installer and there is an update. Perhaps that will fix this problem.

BoogieMAN2K commented 6 years ago

Yeah, you have to manually update VS and then change the Target Framework to Oreo 8.1. In my case set it to automatically the latest didn't work.

stmax82 commented 6 years ago

I just wasted a whole day trying to update Xamarin packages from v25 to v27.

I started with a well working project in VS 2017 v15.5.6. Trying to upgrade packages to v27 resulted in the above error message ("... is not compatible with monoandroid80") over upgrading VS to 15.6.1, which resulted in problems during app start (app appears and disappears without errors), "cannot connect to logcat" errors, killing and restarting the adb server, rebooting, installing/removing android SDKs, build tools, uninstalling the app from the phone and wtfever I cannot even remember all the things I tried today. The last thing I did before the app finally started again was disabling parallel builds!

At the end of that day I seem to be able to start the app again but I have no idea what I did wrong at the beginning, nor what I did to make it work again. Sorry for that lousy error report.

matmiranda commented 6 years ago

I have the same problem here.

Could not install package 'Xamarin.Android.Support.Animated.Vector.Drawable 27.0.2'. You are trying to install this package in a project that is intended for 'MonoAndroid, Version = v8.0', but the package does not contain any assembly or content reference that is compatible with this framework. For more information, please contact the package author.

Has anyone managed to solve the problem?

VladimirCourse commented 6 years ago

Having the same problem, cannot install and update half of packages that I needed.

matmiranda commented 6 years ago

Everyone has this problem, the author should fix this problem as soon as possible.

michelmoorlag commented 6 years ago

@NoleHealth and matmiranda. According to your error message you are trying to install support components with a higher version (api 27) then your targer framework (api 26). That is not possible. You first need to set your target framework to api 27 aka Android 8.1 Oreo before you can update the support components to api 27. See this channel 9 episode where its is explained in more detail: https://channel9.msdn.com/Shows/XamarinShow/Snack-Pack-14-Upgrading-Android-Support-Libraries Or did you do that? If you did and receive this error then it might be bug.

matmiranda commented 6 years ago

@michelmoorlag Huge confusion point cleared up. Thanks.

stmax82 commented 6 years ago

Good video. I'll try that with the next update. I think for me (being new to Xamarin) the error message was quite confusing:

"Package Xamarin.Android.Support.v7.AppCompat 27.0.2 is not compatible with monoandroid80"

I didn't see the link between "... isn't compatible with monoandroid80" and upgrading to API 27, so ended up upgrading VS and trying other stupid things. Maybe the error message could be improved...

aleksvu commented 6 years ago

I've got the same issue. I am using MonoAndroid v8.1 with target API 27. The reason is that linked dependencies are requiring MonoAndroid v8.0. The full chain of dependencies (with monoandroid version in brackets) Xamarin.Android.Support.v7.AppCompat 27.0.2 (monoandorid81)->Xamarin.Android.Support.Compat 27.0.2(monoandorid81)->Xamarin.Android.Arch.Lifecycle.Runtime 1.0.3(monoandroid80 - here starts failure)->Xamarin.Android.Arch.Lifecycle.Common 1.0.3(monoandroid80)

Redth commented 6 years ago

You'll need to have your project set to use <TargetFramework>MonoAndroid81</TargetFramework> which means you'll need Xamarin 15.6 at least installed to use v27.x of android support libraries.

The linked dependencies requiring MonoAndroid 8.0 is something we'll be fixing in the 27.1.0 release, however this should not prevent you from installing this still, though if you're using to specify nuget packages, you may need to explicitly list all of the dependencies in your project file (this is due to resolution failing fast by design with PackageReference, as opposed to the old packages.config style).

We're working on 27.1.0 release which will update the Arch dependencies to 1.1.1 as well, and those will target MonoAndroid81 which hopefully makes things work without being so explicit in your PackageReference listings.

OladotunO commented 6 years ago

Well its working now, what did was 1,Install Android sdk 27.xx and sdk P(Probably unnecessary) 2,Upgraded VS to 15.6.3 3, selected Android 8.1 in project properties for compile using(application tab) target android version(android manifest tab)

I had done the above before, but may have missed out step 3, not sure, but it failed then. Now it works.

Thanks all

MagicAndre1981 commented 6 years ago

This setting was missing for me in csproj:

<AndroidUseLatestPlatformSdk>true</AndroidUseLatestPlatformSdk>

adding it fixed it for me.

<TargetFrameworkVersion>v8.1</TargetFrameworkVersion>

alone was not enough, NuGet still thought I use 'MonoAndroid,Version=v8.0'

jccalbuquerque commented 6 years ago

@michelmoorlag thank you! the video helped me sort it out.

baneageorge commented 6 years ago

For me, it was because I couldn't install 8.1. Visual studio update was necessary. See this: https://blog.xamarin.com/xamarin-android-now-double-stuffed-with-oreo-8-1/

jasonj333 commented 6 years ago

Even though I had set everything to 8.1, I had to go into the .csproj and update TargetFrameworkVersion to 8.1, it still said 8.0. Maybe there is another place I was supposed to set this but editing it manually allowed me to upgrade. <TargetFrameworkVersion>v8.1</TargetFrameworkVersion>

lhughey commented 6 years ago

The old "You must explicitly select the Target framework" bug is back. You can change the value in the application settings by explicitly setting the value, rather than selecting "Use latest platform".

justintemplar commented 6 years ago

@lhughey that's the answer!

divyeshg94 commented 5 years ago

In my case. I have used a Nuget package Geolocator and which is not updated to the latest whereas Support Nuget is updated. So after updating the Geolocator nuget issue resolved

ehabnaim commented 4 years ago

Just update the Targeted SDK to Android 9.0 (Pie), This worked for me

mMarcos208 commented 4 years ago

TargetFrameworkVersion

@MagicAndre1981 Which section do you put it?

MagicAndre1981 commented 4 years ago

@mMarcos208

in first PropertyGroup in Android csproj. I now target 9.0 (required for my used syncfusion controls and here the AndroidUseLatestPlatformSdk entry was removed by Visual Studio.