在用gradle构建我的项目时,我会收到很多这样的警告。我看到了https://stackoverflow.com/a/15794650/864069,但我不清楚如何让这些人闭嘴。听起来,我所依赖的这些东西的任何版本都是为了支持在android.jar中打包的版本而被剥离掉的。
我想这没什么,但我真的想把这些关起来,这样我看到的东西才是真正的问题。
所以,我很好奇:
WARNING: Dependency commons-logging:commons-logging:1.1.1 is ignored for debug as it may be conflicting with the internal version provided by Android.
In case of problem, please repackage it with jarjar to change the class packages
WARNING: Dependency commons-logging:commons-logging:1.1.1 is ignored for debug as it may be conflicting with the internal version provided by Android.
In case of problem, please repackage it with jarjar to change the class packages
WARNING: Dependency commons-logging:commons-logging:1.1.1 is ignored for release as it may be conflicting with the internal version provided by Android.
In case of problem, please repackage it with jarjar to change the class packages
WARNING: Dependency commons-logging:commons-logging:1.1.1 is ignored for release as it may be conflicting with the internal version provided by Android.
In case of problem, please repackage it with jarjar to change the class packages
WARNING: Dependency commons-logging:commons-logging:1.1.1 is ignored for debugTest as it may be conflicting with the internal version provided by Android.
In case of problem, please repackage it with jarjar to change the class packages
WARNING: Dependency commons-logging:commons-logging:1.1.1 is ignored for debugTest as it may be conflicting with the internal version provided by Android.
In case of problem, please repackage it with jarjar to change the class packages
WARNING: Dependency commons-logging:commons-logging:1.1.1 is ignored for robolectric as it may be conflicting with the internal version provided by Android.
In case of problem, please repackage it with jarjar to change the class packages
WARNING: Dependency commons-logging:commons-logging:1.1.1 is ignored for robolectric as it may be conflicting with the internal version provided by Android.
In case of problem, please repackage it with jarjar to change the class packages
WARNING: Dependency commons-logging:commons-logging:1.1.1 is ignored for debug as it may be conflicting with the internal version provided by Android.
In case of problem, please repackage it with jarjar to change the class packages
WARNING: Dependency commons-logging:commons-logging:1.1.1 is ignored for debug as it may be conflicting with the internal version provided by Android.
In case of problem, please repackage it with jarjar to change the class packages
WARNING: Dependency commons-logging:commons-logging:1.1.1 is ignored for release as it may be conflicting with the internal version provided by Android.
In case of problem, please repackage it with jarjar to change the class packages
WARNING: Dependency commons-logging:commons-logging:1.1.1 is ignored for release as it may be conflicting with the internal version provided by Android.
In case of problem, please repackage it with jarjar to change the class packages
WARNING: Dependency commons-logging:commons-logging:1.1.1 is ignored for debugTest as it may be conflicting with the internal version provided by Android.
In case of problem, please repackage it with jarjar to change the class packages
WARNING: Dependency org.apache.httpcomponents:httpclient:4.0.3 is ignored for debugTest as it may be conflicting with the internal version provided by Android.
In case of problem, please repackage it with jarjar to change the class packages发布于 2014-08-22 18:36:24
我不确定这会不会产生问题。最好的做法是遵循警告中的建议,或者完全排除依赖(您的第2点,我已经在下面回答了)。
我也看到了这些警告,特别是“共用日志”的警告。
您所链接的线程中的答案是,您应该忽略这些依赖项,因为Android已经包含了这些依赖项(我认为)。如果我错了,请纠正我。
例如,如果您特别需要公用日志记录(或提供类似警告的其他日志记录),则将其从列表中删除。
build.gradle文件:
dependencies {
...
compile 'commons-logging:commons-logging:1.1.3' #Remove this line; you don't need it.
....
}另外,如果您有一个依赖项,需要将公用日志记录作为一个传递依赖项,那么也应该将它排除在外。
示例:
dependencies {
...
compile 'some.package.that:requires_commons_logging:1.2.3'
....
}变成了
dependencies {
...
compile ('some.package.that:requires_commons_logging:1.2.3') {
exclude group: 'commons-logging', module: 'commons-logging'
}
....
}完全排除它的一种简单方法也可以通过将其添加到build.gradle文件中来完成,而不必在每个依赖项中排除它:
configurations {
all*.exclude group: 'commons-logging', module: 'commons-logging'
}最后,要查看依赖树(并查看每个依赖项各自临时导入哪些可以冲突,非常有用),请从项目的根中使用以下命令:
./gradlew :your_module_name:dependencies发布于 2016-01-25 14:59:44
如果要对警告保持沉默,则必须在build.gradle中为每个依赖项添加以下内容:
exclude group: 'org.apache.httpcomponents', module: 'httpclient'它将是:
dependencies {
...
compile ('some.package.that:requires_commons_logging:1.2.3') {
exclude group: 'commons-logging', module: 'commons-logging'
}
....
}https://stackoverflow.com/questions/25295066
复制相似问题