如何将外部依赖项(jar文件)添加到android studio? [英] How to add external dependencies (jar file) to android studio?
本文介绍了如何将外部依赖项(jar文件)添加到android studio?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试将外部库(httpmime-4.0-sources.jar)添加到android项目中,因为android-studio正在弹出错误,例如
- 错误:包org.apache.http.entity.mime不存在
- 错误:找不到符号类MultipartEntity
- 错误:找不到符号类HttpMultipartMode
<我需要帮助。
作为一种做法,我将jar文件复制到lib文件夹并将其作为库添加。但错误并没有消失。
解决方案
逐步
- 复制JAR文件到libs文件夹
- 在build.gradle文件中注册模块,其说明在步骤3到9中给出
- 打开文件菜单并单击项目结构
- 现在在项目结构对话框中选择模块下的应用程序
- 现在单击项目结构对话框中的依赖项选项卡
- 点击右侧角落的+号
- 从列表中选择文件依赖关系
- 从libs文件夹中选择jar文件
- 点击申请并确认
- 最后点击同步gradle按钮
还有一件事,如果您正在使用它,请检查代理连接。
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
- error: package org.apache.http.entity.mime does not exist
- error:cannot find symbol class MultipartEntity
- error: cannot find symbol class HttpMultipartMode
I need help.
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.
解决方案
Step wise
- Copy JAR File to libs Folder
- Register module in build.gradle file, instructions for which are given in steps 3 through 9
- Open file menu and click on project structure
- Now in Project Structure dialog box select app under module
- Now Click on Dependencies tab in project structure dialog
- Click on + sign in right side corner
- Select File Dependency from list
- Select jar file from libs folder
- Click apply and Ok
- Finally click on sync gradle button
One more thing, check for proxy connection if you are using it.
这篇关于如何将外部依赖项(jar文件)添加到android studio?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文