Forum Xamarin.Android

Announcement:

The Xamarin Forums have officially moved to the new Microsoft Q&A experience. Microsoft Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

To create new threads and ask questions head over to Microsoft Q&A for .NET and get involved today.

Errors generated on empty project with references to ActionBarSherlock and Support Library v4

I created a blank project and added references to the ActionBarSherlock and Support Library. I changed the target framework to Android 4.0 and set the Minimum Android version to API 7 and the Target Android version to "Automatic". Stable and Alpha version of Xamarin Studio produce the same errors. See below:

C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(3,3): Error: Duplicate managed type found! Mappings between managed types and Java types must be unique. First Type: 'Android.Support.V4.App.FragmentManager/IOnBackStackChangedListenerImplementor, Xamarin.Android.Support.v4-r18, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'; Second Type: 'Android.Support.V4.App.FragmentManager/IOnBackStackChangedListenerImplementor, Mono.Android.Support.v4, Version=0.0.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065' (pro.actionbar)

C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(3,3): Error: 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.v4-r18, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'; Second Type: 'Android.Support.V4.Content.Loader/IOnLoadCompleteListenerImplementor, Mono.Android.Support.v4, Version=0.0.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065' (pro.actionbar)

C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(3,3): Error: Duplicate managed type found! Mappings between managed types and Java types must be unique. First Type: 'Android.Support.V4.View.ViewPager/IOnPageChangeListenerImplementor, Xamarin.Android.Support.v4-r18, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'; Second Type: 'Android.Support.V4.View.ViewPager/IOnPageChangeListenerImplementor, Mono.Android.Support.v4, Version=0.0.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065' (pro.actionbar)

C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(3,3): Error: Duplicate managed type found! Mappings between managed types and Java types must be unique. First Type: 'Android.Support.V4.Widget.DrawerLayout/IDrawerListenerImplementor, Xamarin.Android.Support.v4-r18, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'; Second Type: 'Android.Support.V4.Widget.DrawerLayout/IDrawerListenerImplementor, Mono.Android.Support.v4, Version=0.0.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065' (pro.actionbar)

C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(3,3): Error: Duplicate managed type found! Mappings between managed types and Java types must be unique. First Type: 'Android.Support.V4.Widget.SlidingPaneLayout/IPanelSlideListenerImplementor, Xamarin.Android.Support.v4-r18, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'; Second Type: 'Android.Support.V4.Widget.SlidingPaneLayout/IPanelSlideListenerImplementor, Mono.Android.Support.v4, Version=0.0.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065' (pro.actionbar)

Answers

  • ClockAppDevClockAppDev NLMember ✭✭

    ActionbarSherlock already contains the v4 support library in it's binary, therefore adding an additional android support v4 library will make the compiler throw up the duplicate issue.
    Removing the support library from your project should solve this issue (all support library funtionality is available through ActionbarSherlock)

  • To test your theory i created a new Android Application and only added a reference to ActionBarSherlock using the components library. When i set the compile target to the latest version (4.3) and the minimum Android Version to 2.2 API - 8 without adding the Support.v4 i get the errors below. I noticed that there is a reference to the Support.v4 in your sample projects but not in the new project i created. So do i need the reference or not? If so - do i just need to reference it manually and not use the Component Library to include it in the project?

    C:\DeleteMe\WorkMate.Sherlock.Test\WorkMate.Sherlock.Test\obj\Debug\android\src\mono\android\support\v4\app\FragmentManager_OnBackStackChangedListenerImplementor.java(41,41): Error: package android.support.v4.app.FragmentManager does not exist
    android.support.v4.app.FragmentManager.OnBackStackChangedListener
    (WorkMate.Sherlock.Test)

    C:\DeleteMe\WorkMate.Sherlock.Test\WorkMate.Sherlock.Test\obj\Debug\android\src\mono\android\support\v4\app\Watson_OnCreateOptionsMenuListenerImplementor.java(8,8): Error: cannot access android.support.v4.app.FragmentActivity
    class file for android.support.v4.app.FragmentActivity not found
    public class Watson_OnCreateOptionsMenuListenerImplementor
    (WorkMate.Sherlock.Test)

    C:\DeleteMe\WorkMate.Sherlock.Test\WorkMate.Sherlock.Test\obj\Debug\android\src\mono\android\support\v4\content\Loader_OnLoadCompleteListenerImplementor.java(36,36): Error: package android.support.v4.content.Loader does not exist
    android.support.v4.content.Loader.OnLoadCompleteListener
    (WorkMate.Sherlock.Test)

    C:\DeleteMe\WorkMate.Sherlock.Test\WorkMate.Sherlock.Test\obj\Debug\android\src\mono\android\support\v4\content\Loader_OnLoadCompleteListenerImplementor.java(56,56): Error: package android.support.v4.content does not exist
    public void onLoadComplete (android.support.v4.content.Loader p0, java.lang.Object p1)
    (WorkMate.Sherlock.Test)

    C:\DeleteMe\WorkMate.Sherlock.Test\WorkMate.Sherlock.Test\obj\Debug\android\src\mono\android\support\v4\content\Loader_OnLoadCompleteListenerImplementor.java(66,66): Error: package android.support.v4.content does not exist
    private native void n_onLoadComplete (android.support.v4.content.Loader p0, java.lang.Object p1);
    (WorkMate.Sherlock.Test)

    C:\DeleteMe\WorkMate.Sherlock.Test\WorkMate.Sherlock.Test\obj\Debug\android\src\mono\android\support\v4\view\ViewPager_OnPageChangeListenerImplementor.java(36,36): Error: package android.support.v4.view.ViewPager does not exist
    android.support.v4.view.ViewPager.OnPageChangeListener
    (WorkMate.Sherlock.Test)

    C:\DeleteMe\WorkMate.Sherlock.Test\WorkMate.Sherlock.Test\obj\Debug\android\src\mono\android\support\v4\widget\DrawerLayout_DrawerListenerImplementor.java(41,41): Error: package android.support.v4.widget.DrawerLayout does not exist
    android.support.v4.widget.DrawerLayout.DrawerListener
    (WorkMate.Sherlock.Test)

    C:\DeleteMe\WorkMate.Sherlock.Test\WorkMate.Sherlock.Test\obj\Debug\android\src\mono\android\support\v4\widget\SlidingPaneLayout_PanelSlideListenerImplementor.java(46,46): Error: package android.support.v4.widget.SlidingPaneLayout does not exist
    android.support.v4.widget.SlidingPaneLayout.PanelSlideListener
    (WorkMate.Sherlock.Test)

    C:\DeleteMe\WorkMate.Sherlock.Test\WorkMate.Sherlock.Test\obj\Debug\android\src\mono\com\actionbarsherlock\app\ActionBar_TabListenerImplementor.java(97,97): Error: cannot find symbol
    symbol : class FragmentTransaction
    location: package android.support.v4.app
    public void onTabReselected (com.actionbarsherlock.app.ActionBar.Tab p0, android.support.v4.app.FragmentTransaction p1)
    (WorkMate.Sherlock.Test)

    C:\DeleteMe\WorkMate.Sherlock.Test\WorkMate.Sherlock.Test\obj\Debug\android\src\mono\android\support\v4\app\Watson_OnCreateOptionsMenuListenerImplementor.java(190,190): Error: cannot find symbol
    symbol : variable this
    location: class mono.android.support.v4.app.Watson_OnCreateOptionsMenuListenerImplementor
    mono.android.TypeManager.Activate ("Android.Support.V4.App.Watson/IOnCreateOptionsMenuListenerImplementor, ActionBarSherlock, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null", "", this, new java.lang.Object[] { });
    (WorkMate.Sherlock.Test)

  • ClockAppDevClockAppDev NLMember ✭✭
    edited October 2013

    After some testing it seems this error only occurs when downloading the ActionBarSherlock library from the Xamarin Component Store. When downloading the library using the .NET NuGet Package manager this error doesn't occur.

    You may want to try using the NuGet manager and see if this solves the error.

Sign In or Register to comment.