powered by Jive Software

Android progaurd build fails with DuplicatePlatformClasses error

I am using smack-4.3.3 like this in the app.gradle file

    compile "org.igniterealtime.smack:smack-android:4.3.3"
    compile "org.igniterealtime.smack:smack-bosh:4.3.3"
    compile "org.igniterealtime.smack:smack-tcp:4.3.3"
    compile "org.igniterealtime.smack:smack-im:4.3.3"
    compile "org.igniterealtime.smack:smack-extensions:4.3.3"

till the time i am not making a release apk in android studios everything is fine. But as soon as i do that i get this error:

Error: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]

The above error is for ‘commons-logging’.I get the same for ‘xpp3’ and ‘httpclient’.

Now i have done some search and I have found some threads proposing this solution:
(adding the following lines in app.gradle file)

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

This works now, but my doubts are that if i will exclude these modules, how will they be used inside smack whenever and wherever they are being used. Will excluding them not cause any abrupt crashes of the application in the production environment?

Please help me out with this problem(confusion) here !

You can exclude them because that API is provided by the Android platform. That is how they will be used if they are excluded as Maven artifacts.

Many Thanks @Flow, got your point.

This topic was automatically closed 62 days after the last reply. New replies are no longer allowed.