commons-validator 和错误“commons-logging 定义了与 Android 现在提供的类冲突的类"; [英] commons-validator and error "commons-logging defines classes that conflict with classes now provided by Android"

查看:39
本文介绍了commons-validator 和错误“commons-logging 定义了与 Android 现在提供的类冲突的类";的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最近的 Android Studio 更新后,我可以在调试模式下构建和运行应用程序,但由于以下错误而无法再构建发布版本:

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 定义了与 Android 现在提供的类冲突的类.解决方案包括寻找没有相同问题的更新版本或替代库(例如,对于 httpclient,使用 HttpUrlConnection 或 okhttp),或者使用类似 jarjar 的东西重新打包库.[重复平台类]

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]

我已阅读这篇文章这篇文章.两个答案都建议排除模块:'httpclient'".它不能解决我的案例问题.我相当确定它与以下内容有关:

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?

推荐答案

问题在于 commons-logging.所以必须排除.在 app/build.gradle 中添加以下代码.它应该可以工作.

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

这篇关于commons-validator 和错误“commons-logging 定义了与 Android 现在提供的类冲突的类";的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆