Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

commons-logging defines classes that conflict with classes now provided by Android after Android Studio Update

Add to build.gradle located in app module

configurations {
    all {
        exclude module: 'httpclient'
    }
}

If the problem is with commons-logging then it must be excluded too. Add the following code in app/build.gradle

configurations {
    all {
        exclude module: 'httpclient'
        exclude module: 'commons-logging'
    }
}

Got the same issue. I have done below changes

 configurations {
    all{
        exclude group: 'commons-logging', module: 'commons-logging'
        exclude group: 'org.apache.httpcomponents'
    }
}


packagingOptions {
    exclude 'META-INF/LICENSE.txt'
    exclude 'META-INF/LICENSE'
    exclude 'META-INF/NOTICE.txt'
    exclude 'META-INF/NOTICE'
    exclude 'org/apache/http/version.properties'
    exclude 'org/apache/http/client/version.properties'
}

You should replace "compile" with "implementation" as it's deprecated in the latest gradle and exlude "org.apache.httpcomponents" from Google api client libraries:

implementation('com.google.api-client:google-api-client-android:1.23.0') {
    exclude group: 'org.apache.httpcomponents'
}
implementation('com.google.http-client:google-http-client-gson:1.23.0') {
    exclude group: 'org.apache.httpcomponents'
}

this solution was found here: https://developers.google.com/google-apps/activity/v1/quickstart/android