具有firebase依赖性的Android gradle构建有警告(忽略httpclient)

时间:2015-03-08 17:51:01

标签: java android gradle firebase

在我使用firebase的Android项目中,gradle构建显示了这个恼人的警告:

WARNING: Dependency org.apache.httpcomponents:httpclient:4.0.1 is ignored for devDebug 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

我尝试在build.gradle上添加exclude选项,但我没有运气

compile ('com.firebase:firebase-client-android:2.2.1') {
        exclude module: 'org.apache.httpcomponents:httpclient:4.0.1'   //IGNORED
    }

我也尝试删除建议的版本,但警告仍然是

compile ('com.firebase:firebase-client-android:2.2.1') {
        exclude group:'org.apache.httpcomponents', module: 'httpclient'  //SAME
    }

2 个答案:

答案 0 :(得分:4)

我找到了删除警告的选项

configurations {
    compile.exclude group: "org.apache.httpcomponents", module: "httpclient"
}

答案 1 :(得分:2)

如果我没弄错,那应该是

compile ('com.firebase:firebase-client-android:2.2.1') {
        exclude group:'org.apache.httpcomponents', module: 'httpclient'  
}

版本可以省略。