【发布时间】:2019-07-03 12:18:57
【问题描述】:
在 Android Studio 3.4.1 中
app/build.gradle:
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'org.apache.httpcomponents:httpclient:4.5.9'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
但我在这一行出现错误;
implementation 'org.apache.httpcomponents:httpclient:4.5.9'
错误:
httpclient 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. more... (Ctrl+F1)
【问题讨论】:
-
从 build.gradle 中删除这一行时会发生什么?您正在使用这个库的哪些类?
-
@oemel09 然后我得到编译错误:import org.apache.http.HttpHost; - 无法解析符号 HttpHost
标签: android-gradle-plugin apache-httpclient-4.x