Android Build duplicate libraries

Deal with duplicate libraries when building an Android project

First, run Gradle command to find what dependencies duplicate (Duplicate class/package)

./gradlew app:dependencies > ~/Desktop/libs.txt

on Windows:
gradlew app:dependencies > C:\Users\nhanc\Desktop\libs.txt

Config keep one and exclude duplicate lib on app gradle

implementation(projectDependencies.speech) {
    exclude module: 'support-v4'
    exclude group: 'javax.annotation', module: 'javax.annotation-api'
    exclude group: 'com.android.support', module: 'support-annotations'
    exclude group: 'com.google.api-client', module: 'google-api-client-appengine'
    exclude group: 'org.threeten', module: 'threetenbp'
    exclude group: 'com.google.code.findbugs', module: 'jsr305'
    exclude group: 'org.apache.commons', module: 'commons-lang'
    exclude group: 'org.apache.httpcomponents', module: 'httpclient'
}

Note:

net.sf.kxml:kxml2:2.3.0

=> Info
group: net.sf.kxml
module: kxml2
version: 2.3.0 

Leave a Reply

Your email address will not be published.Required fields are marked *