如何将外部依赖项(jar文件)添加到android studio? [英] How to add external dependencies (jar file) to android studio?

查看:489
本文介绍了如何将外部依赖项(jar文件)添加到android studio?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将外部库(httpmime-4.0-sources.jar)添加到android项目中,因为android-studio正在弹出错误,例如




  • 错误:包org.apache.http.entity.mime不存在

  • 错误:找不到符号类MultipartEntity

  • 错误:找不到符号类HttpMultipartMode



<我需要帮助。



作为一种做法,我将jar文件复制到lib文件夹并将其作为库添加。但错误并没有消失。

解决方案

逐步


  1. 复制JAR文件到libs文件夹

  2. 在build.gradle文件中注册模块,其说明在步骤3到9中给出

  3. 打开文件菜单并单击项目结构

  4. 现在在项目结构对话框中选择模块下的应用程序

  5. 现在单击项目结构对话框中的依赖项选项卡

  6. 点击右侧角落的+号

  7. 从列表中选择文件依赖关系

  8. 从libs文件夹中选择jar文件

  9. 点击申请并确认

  10. 最后点击同步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

  1. Copy JAR File to libs Folder
  2. Register module in build.gradle file, instructions for which are given in steps 3 through 9
  3. Open file menu and click on project structure
  4. Now in Project Structure dialog box select app under module
  5. Now Click on Dependencies tab in project structure dialog
  6. Click on + sign in right side corner
  7. Select File Dependency from list
  8. Select jar file from libs folder
  9. Click apply and Ok
  10. Finally click on sync gradle button

One more thing, check for proxy connection if you are using it.

这篇关于如何将外部依赖项(jar文件)添加到android studio?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆