导入外部.jar文件,Android项目 [英] Importing external .jar file to Android project

查看:177
本文介绍了导入外部.jar文件,Android项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有,我已经写了code从互联网解析某些BBC电台的XML数据的标准Java项目。该项目被称为BBCSchedules,我感兴趣的是所谓的BBCChannel,类

I have a standard Java project in which I've written code to parse some BBC Radio XML data from the internet. The project is called BBCSchedules and the class I'm interested in is called BBCChannel.

我现在想要使用BBCChannel类Android应用程序。我应该如何去这样做?

I'm now trying to use the BBCChannel class in an Android application. How should I go about doing this?

我已经试过各种事情,以下建议的互联网上的各种位,我已经到了地方,此刻正在汇编我BBCSchedules项目,以一个.jar文件,并导入到Android项目中使用的构建路径/库/添加外部JAR选项。然而,Eclipse的还是不承认BBCChannel类,不让我跑,因为这样的应用程序。

I've tried various things, following various bits of advice on the internet, and the place I've got to at the moment is compiling my BBCSchedules project to a .jar file, and importing that to the Android project using the Build Path/Library/Add External Jar option. However, Eclipse still doesn't recognise the BBCChannel class, and won't let me run the application because of this.

我想我已经做了一些愚蠢的错误,但它是什么?

I guess I've done something silly wrong, but what is it?

更新:我已经尝试了<上市的步骤href="http://stackoverflow.com/questions/1334802/how-can-I-use-external-jars-in-an-Android-project">How我可以在Android项目使用外部JAR文件?以及各种其他的StackOverflow问题,我能找到,似乎与此有关,但绝对没有什么似乎工作。任何其他的想法?

UPDATE: I've tried the steps listed in How can I use external JARs in an Android project? and various other StackOverflow questions I can find that seem to be related to this, but absolutely nothing seems to work. Any other ideas?

更新:我已经与下面的第一个答案的作者的讨论表明,它是是与我如何使用Eclipse附加.jar文件。该项目他送我,已经连接没有工作.jar文件。任何其他的想法吗?

UPDATE: The discussions I've had with the author of the first answer below suggest that it is something to do with how I am using Eclipse to attach the .jar file. The project he sent me with the .jar file already attached didn't work. Any other ideas anyone?

推荐答案

把你的项目的库/ 目录下的JAR。然后构建路径 - >库 - >添加JAR应该让你挑一个出来你的项目。 IIRC,这适用于Eclipse的。

Put the JAR in your project's libs/ directory. Then Build Path -> Library -> Add JAR should allow you to pick the one out of your project. IIRC, this works with Eclipse.

如果您决定哪天倾倒的Eclipse,只是有在你的JAR 库/ 就够了 - 命令行构建工具会自动把它捡起来。

If you decide someday to dump Eclipse, just having your JAR in libs/ is enough -- the command-line build tools will pick it up automatically.

更新:如果你有R17或更高版本的ADT Eclipse插件的版本,现在你只需要添加一个库/ 目录把你的JAR在那里。它会自动被添加到您的构建路径,就像使用命令行版本。

UPDATE: If you have the R17 or newer version of the ADT Eclipse plugin, now you only need to add a libs/ directory and put your JAR in there. It will automatically be added to your build path, much like with command-line builds.

这篇关于导入外部.jar文件,Android项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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