问题描述
最近的 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 的东西重新打包库.[重复平台类]
我已阅读这篇文章 和 这篇文章.两个答案都建议排除模块:'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 现在提供的类冲突的类";的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!