Android使用HttpClient时出现错误:java.lang.NoSuchFieldError: No static field INSTANCE

在build.gradle文件中添加如下语句:

android {
    useLibrary 'org.apache.http.legacy'
}

dependencies {
    compile('org.apache.httpcomponents:httpmime:4.3.6') {
        exclude module: 'httpclient'
    }
    compile 'org.apache.httpcomponents:httpclient-android:4.3.5.1'
}

你可能感兴趣的:(Android)