Amit
Amit

Reputation: 227

Xamarin.Android.Support.V7.AppCompat vs Xamarin.Android.Support.Compat

Can someone please explain me the difference between Xamarin.Android.Support.V7.AppCompat and Xamarin.Android.Support.Compat?

I totally get why we have to use Xamarin.Android.Support.V7.AppCompat. This is basically to support old verison of Android OS.

I have this reference in my android project but after installing Xamarin.Essentials nuget package, I get the following error:

java.lang.IllegalArgumentException: already added : Landroid/support/annotation/AnimRes

Also after installing Xamarin.Essentials nuget package, my project references Xamarin.Android.Support.Compat library. I am not sure if both the libraries(V7Compat and Compat) needs to be there on my project or should I get rid of the V7Compat library.

Just not sure if I should remove V7AppCompat nuget package from my project?

Upvotes: 0

Views: 462

Answers (1)

Jessie Zhang -MSFT
Jessie Zhang -MSFT

Reputation: 13889

The Xamarin.Android.AppCompat is just what it says. It is a library for App Compatibility for backward compatibility for previous versions of Android. AppCompat should add the functionality of the latest API to older APIs when needed. For instance, lollipop added the CardView class, which can be used in older Android APIs when AppCompat is used, with some minor differences (some of the Android L animations may not apply on older versions of Android for example). And more specifically this version (v7) brings support for Action Bar support.

It is recommended to use AppCompat in most cases since more users will be able to run your app when you do (depending on your MinSdkVersion).

If you want to know what classes you can access in AppCompat, you can take a look at the features here: https://developer.android.com/topic/libraries/support-library/features.html

Besides, after I installed Xamarin.Android.Support.V7.AppCompat,I could install Xamarin.Essentials nuget package normally.

Upvotes: 1

Related Questions