如何使用和包装用我的Andr​​oid应用程序的JAR文件?用我、如何使用、应用程序、文件

2023-09-12 06:26:01 作者:一人美滋滋

我有一个,我想在我的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?

推荐答案

作为解释本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

 
精彩推荐
图片推荐