Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DuplicatePlatformClasses #4

Open
Stillhard opened this issue Jan 16, 2021 · 2 comments
Open

DuplicatePlatformClasses #4

Stillhard opened this issue Jan 16, 2021 · 2 comments

Comments

@Stillhard
Copy link

app\build.gradle: Error: commons-logging defines classes that conflict with classes now provided by Android. Solutions include finding newer versions or alternative libraries that don't have the same problem (for example, for httpclient use HttpUrlConnection or okhttp instead), or repackaging the library using something like jarjar. [DuplicatePlatformClasses]
app\build.gradle: Error: httpclient defines classes that conflict with classes now provided by Android. Solutions include finding newer versions or alternative libraries that don't have the same problem (for example, for httpclient use HttpUrlConnection or okhttp instead), or repackaging the library using something like jarjar. [DuplicatePlatformClasses]

   Explanation for issues of type "DuplicatePlatformClasses":
   There are a number of libraries that duplicate not just functionality of
   the Android platform but using the exact same class names as the ones
   provided in Android -- for example the apache http classes. This can lead
   to unexpected crashes.

   To solve this, you need to either find a newer version of the library which
   no longer has this problem, or to repackage the library (and all of its
   dependencies) using something like the jarjar tool, or finally, rewriting
   the code to use different APIs (for example, for http code, consider using
   HttpUrlConnection or a library like okhttp).

2 errors, 0 warnings

@avegrv can you please change to okhttp instead?

@avegrv
Copy link
Owner

avegrv commented Jan 19, 2021

@Stillhard Right now I don't have a free time. Feel free to make a merge request.

@Stillhard
Copy link
Author

Stillhard commented Jan 19, 2021

@Stillhard Right now I don't have a free time. Feel free to make a merge request.

I'm sorry for such delay, here's the 'final fix':

implementation('com.google.http-client:google-http-client-gson:1.26.0') {
        exclude group: 'commons-logging', module: 'commons-logging'
        exclude group: 'org.apache.httpcomponents', module: 'httpclient'
    }
implementation group: 'commons-codec', name: 'commons-codec', version: '1.15'

Edited to avoid crash ClassNotFoundException

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants