Commons-Logging Defines Classes That Conflict with Classes Now Provided by Android After Android Studio Update

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'
}
}

Error: android defines classes that conflict with classes now provided by Android , when we start to generate release build

Problem

How to see which dependency is creating conflicts. It is same like shooting in dark.

Solution

Some AS plugin that will show you which projects dependency hierarchy. You can find where issue presents exactly and solve that.

Gradle View is an Android Studio plugin that you can install and show dependency hierarchy.

Sample Image

Methods Count is another plugin, it also shows dependency tree.

Sample Image

commons-validator and error commons-logging defines classes that conflict with classes now provided by Android

The problem is with commons-logging. So it must be excluded.
Add the following code in app/build.gradle. It should work.

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

Error while compiling release build in Android Studio 3.0 RC2

Add to build.gradle located in app module

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

Android app level build.gradle giving Error : httpclient defines classes that conflict with classes now provided by Android

I solved it by adding implementation "org.apache.httpcomponents:httpcore:4.4.13" and excluding group: 'org.apache.httpcomponents', module: 'httpclient'

Check this:

implementation('org.apache.httpcomponents:httpmime:4.5.12') {
exclude group: 'org.apache.httpcomponents', module: 'httpclient'
}
implementation "org.apache.httpcomponents:httpcore:4.4.13"


Related Topics



Leave a reply



Submit