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

查看:84
本文介绍了commons-validator和error"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:

错误:错误:commons-logging定义了与Android现在提供的类冲突的类.解决方案包括查找没有相同问题的较新版本或替代库(例如,对于httpclient使用HttpUrlConnection或okhttp代替),或使用jarjar之类的库重新打包该库. [DuplicatePlatformClasses]

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和error"commons-logging定义了与Android现在提供的类冲突的类".的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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