Base solution for your next web application
Ends in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

java.lang.IllegalArgumentException: already added : Lcom/squareup/okhttp/Address; #6054


User avatar
0
avanekar02 created

hello

i am getting this error when i added the xamarin chat sdk packages to my Android project, seems to be duplication of the okhttp/Adress any suggestions on the same.

Severity Code Description Project File Line Suppression State Error java.lang.IllegalArgumentException: already added : Lcom/squareup/okhttp/Address; NOOR.Sched.Mobile.Droid

Anwar


6 Answer(s)
  • User Avatar
    0
    alper created
    Support Team

    hi,

    As I understand, OkHttp cannot be used multiple in an application and both xamarin chat sdk and ModernHttpClientFactory uses OkHttp.

    We use ModernHttpClientFactory as a FlurlHttpClientFactory.

    As an alternative you can remove FlurlHttp and use another HttpClient.. see the alternatives https://dotnet.libhunt.com/flurl-alternatives

    The checkpoints where you can see the usage of the library.

    • https://github.com/aspnetzero/aspnet-zero-core/blob/f72d4bf9ced778e06265f1c415a8553b10cbaf3d/aspnet-core/src/MyCompanyName.AbpZeroTemplate.Mobile.Droid/Activities/SplashActivity.cs#L82

    • https://github.com/aspnetzero/aspnet-zero-core/blob/fe85687cd6ff316fddd74e4b576765747819781f/aspnet-core/src/MyCompanyName.AbpZeroTemplate.Mobile.iOS/AppDelegate.cs#L74

    • https://github.com/aspnetzero/aspnet-zero-core/blob/f72d4bf9ced778e06265f1c415a8553b10cbaf3d/aspnet-core/src/MyCompanyName.AbpZeroTemplate.Application.Client/ApiClient/ModernHttpClientFactory.cs

    ModernHttpClient which uses OkHttp

  • User Avatar
    0
    avanekar02 created

    thanks for the reply

    which alternative to FlurlHttp do you recommend,

    thanks and the last link "ModernHttpClient which uses OkHttp" i am not clear.

    also will changing to an alternative http have consequences.

    thanks Anwar

  • User Avatar
    0
    alper created
    Support Team

    comment out these lines and try again

    • https://github.com/aspnetzero/aspnet-zero-core/blob/f72d4bf9ced778e06265f1c415a8553b10cbaf3d/aspnet-core/src/MyCompanyName.AbpZeroTemplate.Mobile.Droid/Activities/SplashActivity.cs#L66
    • https://github.com/aspnetzero/aspnet-zero-core/blob/fe85687cd6ff316fddd74e4b576765747819781f/aspnet-core/src/MyCompanyName.AbpZeroTemplate.Mobile.iOS/AppDelegate.cs#L42
  • User Avatar
    0
    avanekar02 created

    I commented line 66 ConfigureFlurlHttp(); but still the same error alper

    Severity Code Description Project File Line Suppression State Error java.lang.IllegalArgumentException: already added : Lcom/squareup/okhttp/Address; NOOR.Sched.Mobile.Droid

    regards Anwar

  • User Avatar
    0
    avanekar02 created

    any input on this

  • User Avatar
    0
    alper created
    Support Team

    you can replace Flurl with Refit