如何使用和包装用我的Andr​​oid应用程序的JAR文件? [英] How to use and package a JAR file with my Android app?

查看:211
本文介绍了如何使用和包装用我的Andr​​oid应用程序的JAR文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个,我想在我的Andr​​oid应用程序使用的JAR形式的API。不知道是否应该在Eclipse项目的一部分,或保持独立,并添加到项目属性。这个JAR还需要与应用程序打包,所以这是怎么一回事for Android应用程序?

I have an API in the form of a JAR that I would like to use in my Android app. Not sure if it should be part of the project in Eclipse or kept separate and added to the project properties. This JAR also needs to be packaged with the application, so how is that done for Android apps?

推荐答案

作为解释本<一个href="http://stackoverflow.com/questions/1334802/how-can-i-use-external-jars-in-an-android-project">SO问题:

  • 您的项目 - >右键 - >导入 - >存档文件 - > yourjar.jar
  • 您的项目 - >右键 - >属性 - > Java构建路径 - >库 - >添加罐 - > yourjar.jar
  • Your Project -> right click -> Import -> Archive File -> yourjar.jar
  • Your Project -> right click -> Properties -> Java Build Path -> Libraries -> Add Jar -> yourjar.jar

您必须将其添加为外部JAR的文件,并设置您的Eclipse项目的排序和导出。

You must add it as "external JAR" files, and set the "Order and Export" in your Eclipse project.

2012更新2月:

Pacerier 中有一个问题(ClassNotFound的)的评论中提到,即使他做了声明库。
他有:

Pacerier mentions in the comment having an issue (ClassNotFound) even though he did declare the library.
He had:

不过,解决的办法很简单:

However, the solution was simple:

在1小时内浪费。男人是我生气!
解决方法:请确保您的JAR文件编译了1.6和1.7不
。 哎呀

Over 1 hour wasted. Man was I pissed!
Solution: make sure your JAR is compiled with 1.6 and not 1.7.
Argh

这篇关于如何使用和包装用我的Andr​​oid应用程序的JAR文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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