Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

xamarin android support library v7 and v13 in the same app

Until today I've been using support library v13 in my app. Now I also need to use support library v7.

I added them to my app, but I have some problems.

  1. At the first compile I got a lot of error about not found resources. I solved this one by setting the api level to 15 and min to 8. This was suggested on stackoverflow. Can someone explain why this is needed?

    2.Now I receive some errors saying Duplicate managed type found! Mappings between managed types and Java types must be unique. First Type: 'Android.Support.V4.Content.Loader/IOnLoadCompleteListenerImplementor, Xamarin.Android.Support.v13, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'; Second Type: 'Android.Support.V4.Content.Loader/IOnLoadCompleteListenerImplementor, Xamarin.Android.Support.v4, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.

    I guess this is because v13 allready has some types from v4 and v7 is referencing v4. Any idea?

like image 567
user3149483 Avatar asked Dec 31 '13 14:12

user3149483


People also ask

How do I change the minimum Android version in Xamarin?

Go to android project then right click -> Properties -> Android Manifest (scroll down) then you will see Minimun android version and Target android version.

Does Xamarin support AndroidX?

Requirements. The following list is required to use AndroidX features in Xamarin-based apps: Visual Studio - On Windows update to Visual Studio 2019 version 16.4 or later. On macOS, update to Visual Studio 2019 for Mac version 8.4 or later.

How many APIs are there in Android?

Android exposes three Android API level project settings: Target Framework – Specifies which framework to use in building your application.

How do I deploy Xamarin to Android?

Copy the file to your Android device's physical memory or an SD card and then run the file from your device. Android, by default, blocks installation of Apps that are not from PlayStore. To install your App, you must enable it to accept the App installation from the Settings.


1 Answers

From http://developer.android.com/tools/support-library/features.html:

v4 Support Library:

This library is designed to be used with Android 1.6 (API level 4) and higher. It includes the largest set of APIs compared to the other libraries, including support for application components, user interface features, accessibility, data handling, network connectivity, and programming utilities. Here are a few of the key classes included in the v4 library:

v7 Support Library:

There are several libraries designed to be used with Android 2.1 (API level 7) and higher. These libraries provide specific feature sets and can be included in your application independently from each other.

v8 Support Library:

This library is designed to be used with Android (API level 8) and higher. It adds support for the RenderScript computation framework. These APIs are included in the android.support.v8.renderscript package. You should be aware that the steps for including these APIs in your application is very different from other support library APIs. For more information about using these APIs in your application, see the RenderScript developer guide.

v13 Support Library:

This library is designed to be used for Android 3.2 (API level 13) and higher. It adds support for the Fragment user interface pattern with the (FragmentCompat) class and additional fragment support classes For more information about fragments, see the Fragments developer guide. For detailed information about the v13 Support Library APIs, see the android.support.v13 package in the API reference.

If you look at your error, you have two dependencies conflicting because you have both v4 and v13 imported. You can see how they have similar classes here:

http://developer.android.com/reference/android/support/v4/app/package-summary.html http://developer.android.com/reference/android/support/v13/app/package-summary.html

You should use v4 for min-sdk = 4-12 and v13 for min-sdk = 13+

Though you can use v13 in lower API versions of android, your apps will crash on anything <12 API. You should be able to use v7 and v13 just fine as long as you don't conflict with v4.

EDIT: Here's a video explaining android support libraries that came out recently http://xamarin.wistia.com/medias/guqtgpdqms

Source Code: https://github.com/jamesmontemagno/Xamarin.Android-AppCompat

Source: Xamarin

like image 91
Jon Douglas Avatar answered Oct 20 '22 00:10

Jon Douglas