avegrv / google-drive-api-sample

This is sample based on Google Drive API. Simple use case - using Google Drive to backup and restore SQLite Database.
12 stars 6 forks source link

DuplicatePlatformClasses #4

Open Stillhard opened 3 years ago

Stillhard commented 3 years ago
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 commented 3 years ago

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

Stillhard commented 3 years ago

@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