我正在开发一款需要使用MultipartEntityBuilder的应用。 要使用它,我已经包含了org.apache.httpcomponents:httpmime:4.4
以下是该应用的代码段:
MultipartEntityBuilder builder = MultipartEntityBuilder.create();
builder.setMode(HttpMultipartMode.BROWSER_COMPATIBLE);
builder.addPart("file", new FileBody(new File(filePath)));
builder.addTextBody("type", type);
builder.addTextBody("phone", pPhoneNumber);
现在的问题是,FileBody在这里需要包含在org.apache.httpcomponents:httpcore中的ContentType类。但是如果我在Gradle中导入它,由于与Android提供的内部版本冲突,我无法继续编译。我收到了以下错误:
Error:duplicate files during packaging of APK /somepath/app/build/outputs/apk/app-debug-unaligned.apk
Path in archive: META-INF/DEPENDENCIES
Origin 1: /Users/Sachin/.gradle/caches/modules-2/files-2.1/org.apache.httpcomponents/httpmime/4.4/54646f004d5b4c37a5a75b1d416c59a3075204e2/httpmime-4.4.jar
Origin 2: /Users/Sachin/.gradle/caches/modules-2/files-2.1/org.apache.httpcomponents/httpcore/4.4.1/f5aa318bda4c6c8d688c9d00b90681dcd82ce636/httpcore-4.4.1.jar
请提出解决方案。