如何将外部依赖项(jar 文件)添加到 android studio?
问题描述:
我正在尝试将外部库(httpmime-4.0-sources.jar)添加到 android 项目中,因为 android-studio 会弹出像
I am trying to add external libraries(httpmime-4.0-sources.jar) to android project irked by the fact that android-studio is popping up errors like
- 错误:包 org.apache.http.entity.mime 不存在
- 错误:找不到符号类 MultipartEntity
- 错误:找不到符号类HttpMultipartMode
我需要帮助.
作为一种实践,我将 jar 文件复制到 lib 文件夹并将其添加为库.但错误并没有消失.
As a practice I copied the jar file to the lib folder and added that as a library. But the error does not go away.
答
循序渐进
- 将 JAR 文件复制到 libs 文件夹
- 在 build.gradle 文件中注册模块,步骤 3 到 9 中给出了相关说明
- 打开文件菜单并点击项目结构
- 现在在项目结构对话框中选择模块下的应用程序
- 现在单击项目结构对话框中的依赖项选项卡
- 点击右上角的+号
- 从列表中选择文件依赖
- 从libs文件夹中选择jar文件
- 点击应用并确定
- 最后点击同步gradle按钮
还有一件事,如果您正在使用代理连接,请检查它.
One more thing, check for proxy connection if you are using it.