After recent Android Studio update, I can build and run an app in the debug mode, but am no longer able to build the release version due to the following 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]
I have read this post and this post. Both answers suggest "exclude module: 'httpclient'". It does not solve the problem of my case. I am fairly sure it is related to the following:
compile 'commons-validator:commons-validator:1.6'
Could anyone offer a tip on the remedy?
The problem is with commons-logging. So it must be excluded. Add the following code in app/build.gradle. It should work.