error : java.lang.IllegalArgumentException: already added : Landroid/support/v4/accessibilityservi

PravinPatilPravinPatil USMember ✭✭
edited November 2016 in Xamarin.Android

Hello,

2> Uncaught translation error: java.lang.IllegalArgumentException: already added: Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompat; (TaskId:343)
2> Uncaught translation error: java.lang.IllegalArgumentException: already added: Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompat$AccessibilityServiceInfoIcsImpl; (TaskId:343)
2> Uncaught translation error: java.lang.IllegalArgumentException: already added: Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompat$AccessibilityServiceInfoStubImpl; (TaskId:343)
2> Uncaught translation error: java.lang.IllegalArgumentException: already added: Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompat$AccessibilityServiceInfoVersionImpl; (TaskId:343)
2> Uncaught translation error: java.lang.IllegalArgumentException: already added: Landroid/support/v4/animation/AnimatorCompatHelper; (TaskId:343)
2> Uncaught translation error: java.lang.IllegalArgumentException: already added: Landroid/support/v4/app/ActionBarDrawerToggle; (TaskId:343)
2> Uncaught translation error: java.lang.IllegalArgumentException: already added: Landroid/support/v4/app/ActionBarDrawerToggle$ActionBarDrawerToggleImpl; (TaskId:343)
2> Uncaught translation error: java.lang.IllegalArgumentException: already added: Landroid/support/v4/app/ActionBarDrawerToggle$ActionBarDrawerToggleImplBase; (TaskId:343)
2> Uncaught translation error: java.lang.IllegalArgumentException: already added: Landroid/support/v4/app/ActionBarDrawerToggle$ActionBarDrawerToggleImplHC; (TaskId:343)

I am getting above error while using following nuget packages together,

package id="Bolts" version="1.4.0.1" targetFramework="monoandroid70"
package id="MvvmCross" version="4.4.0" targetFramework="monoandroid70"
package id="MvvmCross.Binding" version="4.4.0" targetFramework="monoandroid70"
package id="MvvmCross.Core" version="4.4.0" targetFramework="monoandroid70"
package id="MvvmCross.Droid.Shared" version="4.4.0" targetFramework="monoandroid70"
package id="MvvmCross.Droid.Support.Core.UI" version="4.4.0" targetFramework="monoandroid70"
package id="MvvmCross.Droid.Support.Fragment" version="4.4.0" targetFramework="monoandroid70"
package id="MvvmCross.Droid.Support.V7.AppCompat" version="4.4.0" targetFramework="monoandroid70"
package id="MvvmCross.Platform" version="4.4.0" targetFramework="monoandroid70"
package id="MvvmCross.Plugin.Json" version="4.4.0" targetFramework="monoandroid70"
package id="MvvmCross.Plugin.Messenger" version="4.4.0" targetFramework="monoandroid70"
package id="MvvmCross.Plugin.Visibility" version="4.4.0" targetFramework="monoandroid70"
package id="Newtonsoft.Json" version="9.0.1" targetFramework="monoandroid70"
package id="Xamarin.Android.Support.Animated.Vector.Drawable" version="24.2.1" targetFramework="monoandroid70"
package id="Xamarin.Android.Support.Compat" version="24.2.1" targetFramework="monoandroid70"
package id="Xamarin.Android.Support.Core.UI" version="24.2.1" targetFramework="monoandroid70"
package id="Xamarin.Android.Support.Core.Utils" version="24.2.1" targetFramework="monoandroid70"
package id="Xamarin.Android.Support.CustomTabs" version="23.4.0.1" targetFramework="monoandroid70"
package id="Xamarin.Android.Support.Fragment" version="24.2.1" targetFramework="monoandroid70"
package id="Xamarin.Android.Support.Media.Compat" version="24.2.1" targetFramework="monoandroid70"
package id="Xamarin.Android.Support.v4" version="23.4.0.1" targetFramework="monoandroid70"
package id="Xamarin.Android.Support.v7.AppCompat" version="24.2.1" targetFramework="monoandroid70"
package id="Xamarin.Android.Support.v7.CardView" version="23.4.0.1" targetFramework="monoandroid70"
package id="Xamarin.Android.Support.Vector.Drawable" version="24.2.1" targetFramework="monoandroid70"
package id="Xamarin.Facebook.Android" version="4.16.1" targetFramework="monoandroid70"

Problem came up when I have added Xamarin.Facebook.Android nuget package. Looks like it is related with Xamarin.Android.Support.v4 package but I can not remove that packages since other packages depends on it.

How to resolve this issue?

Answers

  • BerayBentesenBerayBentesen TRUniversity ✭✭✭✭

    @PravinPatil This means you have the same library twice but the versions are different and it seems that library is support v4. Try to install support v4 after installing Facebook library.

  • PravinPatilPravinPatil USMember ✭✭

    How to do that? I have tried removing spport v4 library but getting an error.

  • VinayakGawasVinayakGawas USMember ✭✭✭

    How did u solve this error.. @PravinPatil ??
    Stuck on the same error.

  • VivekVVivekV USMember

    Remove all old reference .dlls and relevant to that and add again from NuGet.

  • SergioHolgadoSergioHolgado ESMember

    Hi, I have the same error after I have added the Xamarin.Facebook reference. Any clue to fix it? I have tested to remove and add again the library Xamarin.Android.Support.v4 but the issue remanins. Any new idea? Thanks

  • PravinPatilPravinPatil USMember ✭✭

    Sorry, I don't remember exactly what I did. I guess, updating all the Nuget packages in my project solved the problem.

  • VivekVVivekV USMember
    edited March 16

    @SergioHolgado just add Xamarin.Facebook.Android Version 4.8.2.2 reference from NuGet. It's working for me.

  • alextnalextn USMember ✭✭

    To resolve my issue:

    /Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets: Error: java.lang.IllegalArgumentException: already added : Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompat;

    I remove every Xamarin.Android.Support... (and their dependencies like Xamarin.Forms) in my Droid project and add them again ; it seems to work for now.

  • Tinus.6160Tinus.6160 USUniversity ✭✭

    My issue was that one of the support libraries version was a different version than the others, a 3rd party nuget was to blame. Updating all to the same version did the trick.

  • Pacheco.7272Pacheco.7272 BRMember

    Obrigado @Cwphilli (Colin Phillips), essa sua sugestão foi a única que funcionou depois de 9 horas tentando resolver o problema!

  • Ajay_SBSICAjay_SBSIC USMember ✭✭

    Just need to update new get packages related to xamarin forms and support.V4,v7, AppCompat

  • EL_PAPIEL_PAPI USMember ✭✭

    Hi guys. I'm having a problem un-installing those packages that was mentioned above it said " Error Unable to uninstall 'Crosslight.Xamarin.Android.Support.v4.23.1.1' because 'Crosslight.Xamarin.Android.Support.Design.23.1.1, Crosslight.Xamarin.Android.Support.v7.AppCompat.23.1.1, Crosslight.Xamarin.Android.Support.v7.CardView.23.1.1, Crosslight.Xamarin.Android.Support.v7.RecyclerView.23.1.1' depend on it."

    I can't un-install the duplicate package...

  • nelsondmartineznelsondmartinez ARMember

    The same as Charlin, solved it updating Xamarin.Android.Support.V4 to latest version

  • MaulikParmarMaulikParmar USMember

    Thanks @Charlin and @nelsondmartinez
    It worked for me.

  • GrahamHickson.4124GrahamHickson.4124 USMember ✭✭

    Do you know if this would affect the building of Forms projects as i'm receiving this issue in our projects.

    Updating of Android support libraries other than when done by Xamarin.Forms updating is considered a no go usually?

    @Charlin said:
    I had the same issue, solved it updating Xamarin.Android.Support.v4 to latest version

  • UdaraAlwisUdaraAlwis LKMember ✭✭

    I had this issue after installing Acr.UserDialogs library into my Xamarin.Forms project, upon Android compilation. I fixed it by updating Xamarin.Android.Support.v4 to latest version as @Charlin recommended! :) Thanks for your suggestion.

  • RasmusChristensenRasmusChristensen DKUniversity ✭✭

    @UdaraAlwis Same lib, same issue, same solution thanks to @Charlin

  • Rechuchanboy2Rechuchanboy2 ESMember ✭✭

    The same as Charlin, solved it updating Xamarin.Android.Support.V4 to latest version

  • KarunakarBhogyariKarunakarBhogyari USMember ✭✭

    Updating all packages from Manage nuget package solved this.

  • AnouarBenZahraAnouarBenZahra USMember

    [Resolved] !!
    I have update the Xamarin.Android.Support to 25.4.0.1
    To do this :
    1. Go to solution,
    2. Manage NuGet
    3. search for Xamarin.Android.Support
    4. update Xamarin.Android.Support.Compat to 25.4.0.1

  • cicerojrcicerojr BRMember ✭✭

    I updated Android Support libraries and got it working again.

  • KokulJoseKokulJose INMember

    Updating all nuget packages made the solution to the error.

  • GercoBrandwijkGercoBrandwijk USMember ✭✭
    edited August 25

    I had also this issue with Acr.UserDialogs (upgraded to version v6.5.1). I also reported this at the GitHub of Acr.UserDialogs: https://github.com/aritchie/userdialogs/issues/419, but got the message that Xamarin.Forms is not supported.

    In contrast to the advice of Xamarin (don't install Android.Support packages yourself, but let the package Xamarin.Forms handle that for you), I also installed the Xamarin.Android.Support.v4 package in my Droid project (I used v25.3.1). After that the project was miraculously building :)

  • FrankSchwietermanFrankSchwieterman USMember ✭✭

    I hit a similar exception, but for a different component. But since this post comes up on the top search result, I wanted to note its worth trying to clean the solution. I had switched branches and this caused mixed versions of a component to be pulled in somewhere. To fix it I had to delete all obj and bin directories.

  • ni1ni1 INMember ✭✭

    @PravinPatil said:
    Sorry, I don't remember exactly what I did. I guess, updating all the Nuget packages in my project solved the problem.

    Thnaks..

  • HomeroLaraHomeroLara USUniversity, Developer Group Leader ✭✭

    Thanks @Charlin That worked for me.

  • What if u update?, that not lose compatibility with older android version? I solve this issue too if I uncheck option local copy from package, but I don't know what solution is the best, I need to maintain android 4.4 compatibility.

  • juandavidrzjuandavidrz COMember

    I updated Xamarin.Android.Support.v4 package and now works fine, Thanks!

  • IvanositoIvanosito COMember ✭✭

    After installing xam.plugin-media 3.0.1 plugin I got that error. - Still not able to fix it. :(
    java.lang.IllegalArgumentException: already added : Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompat;

  • IvanositoIvanosito COMember ✭✭

    I finally solved it. I used a mixture of the solutions given here:

    • First tried only Update-Package -reinstall, but without Update-Package.
    • Then I tried to update android's project Xamarin.Android.Support.Compat ... but didn't solve it
    • I finally tried updating Xamarin.Android.Support4 to version 26.0.2-rc1 ... and WOW, Android was back!

    Even better, the plugin worked and I could take my first pic after more tan 12 hours fighting with it!

    THANKS to all of you! Without you, it would have been impossible.

  • XnainaXnaina USMember ✭✭✭

    @Ivanosito Your solution worked for me. Thank you.
    (Y)

  • mohsinkhanmohsinkhan USMember ✭✭

    updating all the Nuget packages in your project solved the problem

  • mohsinkhanmohsinkhan USMember ✭✭

    @mohsinkhan said:
    updating all the Nuget packages in your project will solve the problem

  • mario.moramario.mora USMember ✭✭

    None of these solutions worked for me.
    In a clean project only with forms v2.4.0.282 and Xam.Plugin.Media v3.0.1 , I received this:

    Error java.lang.IllegalArgumentException: already added : Landroid/support/v4/view/VelocityTrackerCompat

    the only thing that worked was downgrading the Xam.Plugin.Media from v3.0.1 to v2.6.2

  • JoshuaLatusiaJoshuaLatusia USMember ✭✭
    edited October 24

    What I did was look at my .csproj file in there. Apparently, in there-there where some references which I did not see in my Visual Studio project. To resolve this look if there is a reference in the csproj file which is not visible in VS. After you found the references just delete them. This is one of the references I deleted from the Android csproj.
    <Reference Include="Xamarin.Android.Support.Compat, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL"> <HintPath>..\packages\Xamarin.Android.Support.Compat.25.3.1\lib\MonoAndroid70\Xamarin.Android.Support.Compat.dll</HintPath> </Reference>

  • JoshuaLatusiaJoshuaLatusia USMember ✭✭

    @mario.mora
    Downgrading worked for me after I removed the automatically added references Xam.Plugin.Media v3.0.1. it put in my Android csproj
    Thanks!

  • SreeeeSreeee INMember ✭✭✭

    Hi @BerayBentesen @PravinPatil @Charlin
    No solutions worked for me. Still showing :

    Severity Code Description Project File Line Suppression State
    Error java.lang.IllegalArgumentException: already added : Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompat; SmartTweet.Android

    Anybody please help me.

    Thanks in advance.

Sign In or Register to comment.