我怎样才能在Android项目使用外部JAR文件? [英] How can I use external JARs in an Android project?

查看:129
本文介绍了我怎样才能在Android项目使用外部JAR文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经创建了一个Android项目,并增加了外部JAR(粗麻布-4.0.1.jar)到我的项目。然后,我将JAR添加到构建路径,并为了和出口检查它关闭。

I have created an Android project and added an external JAR (hessian-4.0.1.jar) to my project. I then add the JAR to the buildpath and check it off in Order and Export.

订单和出口被忽略,似乎,并且从外部JAR中的所有类都缺少运行。

Order and Export is ignored it seems, and all classes from the external JAR are missing in runtime.

有一招从外部JAR建筑使用Eclipse插件Android应用程序时正确包含所需的类。我并不想使用Ant或Maven。

Is there a trick to properly include the needed classes from an external JAR when building an Android application using the Eclipse Plug-In. I do not want to use ant or Maven.

推荐答案

外部JAR文件添加到您的Andr​​oid项目或Java项目的一个好方法是:

A good way to add external JARs to your Android project or any Java project is:

  1. 创建你的项目的根文件夹,名为 文件夹
  2. 您的 JAR文件复制到文件夹
  3. 现在右键点击Jar文件,然后选择构建路径>添加到构建 路径,这将创建一个文件夹,名为引用的库内的 项目

  1. Create a folder called libs in your project's root folder
  2. Copy your JAR files to the libs folder
  3. Now right click on the Jar file and then select Build Path > Add to Build Path, which will create a folder called 'Referenced Libraries' within your project

这样,你不会 失去了你的库正在上引用您 硬盘驱动器,只要你的项目转移到另一台计算机。

By doing this, you will not lose your libraries that are being referenced on your hard drive whenever you transfer your project to another computer.

这篇关于我怎样才能在Android项目使用外部JAR文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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