【问题标题】:Can not resolve org.apache.http.entity.mime.MultipartEntity , HttpMultipartMode无法解析 org.apache.http.entity.mime.MultipartEntity 、 HttpMultipartMode
【发布时间】:2016-11-22 08:17:56
【问题描述】:

Snapshot of Android Studio screen

Snapshot of error messages inside Android Studio

我遵循了这里提到的建议,但无法解决错误。How to add external dependencies (jar file) to android studio?

请建议我在这里缺少什么?

1:

1:

【问题讨论】:

标签: android android-gradle-plugin multipartentity


【解决方案1】:

1) 将此行添加到 build.gradle 文件的 android 标签中

useLibrary 'org.apache.http.legacy'

添加这一行后的样子:

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.2"
    useLibrary 'org.apache.http.legacy'

请检查此链接以了解为什么需要添加此链接: https://developer.android.com/about/versions/marshmallow/android-6.0-changes.html#behavior-apache-http-client

2) 如果你已经下载了 jar 已经跳过这一步,我在屏幕截图中看到你已经将它添加到你的 build.gradle 文件中。

下载此文件并从中提取 jar。 http://www.java2s.com/Code/JarDownload/httpmime/httpmime-4.1.1.jar.zip

并将这个库添加到您的库文件夹中。现在右键单击该 jar 文件并单击选项“添加为库...”

这应该可以工作

【讨论】:

    【解决方案2】:

    将以下行添加到 build.graddle 中的依赖项

    implementation group: 'org.apache.httpcomponents', name: 'httpmime', version: '4.3.1'
    

    【讨论】:

      【解决方案3】:

      将 jar 添加到您的 build.gradle(模块:app)

      compile group: 'org.apache.httpcomponents', name: 'httpmime', version: '4.0-alpha3'
      

      源:https://mvnrepository.com/artifact/org.apache.httpcomponents/httpmime/4.0-alpha3

      更新:您可能需要使用 Android Studio 3.0 将 compile 更改为 implement

      【讨论】:

        【解决方案4】:

        在应用级 build.gradle 文件中添加以下行 实现“org.apache.httpcomponents:httpmime:4.3”

        【讨论】:

          【解决方案5】:

          从这里下载 Jar 文件:https://mvnrepository.com/artifact/org.apache.httpcomponents/httpmime/4.3.1 然后将它们添加到您的 app->libs 文件夹以及使用 compile('libs/jar_file_name') 的 gradle 中。就是这样。

          【讨论】:

            猜你喜欢
            • 2021-10-23
            • 2016-05-19
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            • 2013-12-14
            相关资源
            最近更新 更多