使用 eclipse 将 jar 包含到 apk 中

发布于 2024-12-23 09:08:19 字数 676 浏览 3 评论 0原文

我试图在我的 apk 文件中包含一个 jar 文件。

我尝试了以下方法:

    • 将 jar 复制到我的项目中的 lib 目录
    • 将 jar 添加到路径
    • 启用 jar 导出
    • 只需将 jar 添加到我的项目路径(其他位置)
    • 启用 jar 导出

但 apk 不包含该 jar。当我尝试启动应用程序时,控制台告诉我:

Installation error: INSTALL_FAILED_MISSING_SHARED_LIBRARY
Please check logcat output for more details.
Launch canceled!

我正在使用

Eclipse IDE for Java Developers 版本:Indigo 服务版本 1 内部版本号:20110916-0149
and
Android 开发工具 包 版本:16.0.1.v201112150204-238534

编辑: 这个问题就解决了。如果我没有在清单中根据需要声明该库,它就可以工作。 (奇怪的行为)

I am trying to include a jar file in my apk file.

I tried the following:

    • copy the jar into lib directory in my project
    • add jar to path
    • enable the jar for export
    • simply add the jar to my project path (location anywhere else)
    • enable jar for export

But the apk does not include the jar. When I try to lanch the application the console tells me:

Installation error: INSTALL_FAILED_MISSING_SHARED_LIBRARY
Please check logcat output for more details.
Launch canceled!

I'm using

Eclipse IDE for Java Developers
Version: Indigo Service Release 1
Build id: 20110916-0149

and

Android Development Toolkit
Version: 16.0.1.v201112150204-238534

EDIT:
This problem is solved. If I don't declare the libary as needed in the manifest it works.
(Strange behaviour)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(9

俏︾媚 2024-12-30 09:08:19

确保您的 .JAR 是使用 JavaSE-1.6 而不是 1.7 创建的

Make sure your .JAR is created with JavaSE-1.6, not 1.7

眼角的笑意。 2024-12-30 09:08:19

不确定您是否已经解决了这个问题,但我遇到了类似的问题,当我尝试在模拟器上运行应用程序时,仅将“.jar”文件添加到库中并没有帮助。

最终让我取得进展的是经历同样的事情并添加如上所述的库,然后在“Java Build Path”对话框中,转到“Order and Export”选项卡,然后选择那里的 jar 文件, 也。然后 .apk 明显变大,应用程序完成了初始启动。 (后来它仍然死了,但我认为那里还有另一个权限问题。)

我希望这有帮助吗?

Not sure if you've resolved this, but I was having a similar problem and just adding the ".jar" file to the lib was not helping when I tried to run the app on the emulator.

What did finally allow me to make progress was to go through the same thing and add the library as described above, and then in the "Java Build Path" dialog, go to the "Order and Export" tab, and select the jar file there, too. Then the .apk was noticeably bigger, and the app got through the initial startup. (It still died afterward, but I think there is another permission problem there.)

I hope this helps?

木有鱼丸 2024-12-30 09:08:19

也许你已经尝试过这个?:

右键单击项目-->属性 -

  • 选择Java构建路径
  • 确保是在顶部选择的选项卡
  • 单击添加外部 JAR

然后找到您的 JAR...你的项目中不需要它。

Maybe you have tried this?:

Right click Project --> Properties --

  • Select Java Build Path
  • Make sure Libraries is the tab selected at the top
  • Click Add External JARs

Then find your JAR...you don't need it in your project.

我的影子我的梦 2024-12-30 09:08:19

对我来说,以下方法有效:

  1. 打开项目文件夹中的 .classpath 文件。
  2. 检查它是否包含该行

    />
    

    在我的例子中,它丢失了,所以将其添加到文件中。

  3. 重启Eclipse

For me, the following worked:

  1. Open .classpath file in project folder.
  2. Check it contains the row

    <classpathentry kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
    

    In my case, it was missing, so added it to the file.

  3. Restart Eclipse
秋凉 2024-12-30 09:08:19

右键单击项目-->属性--> Java 构建路径 -->添加外部 JAR。

并选择你想要添加什么的jar。单击确定..

Right click on project --> Properties --> Java BuildPath --> Add External JARs.

and select jar what do you want add. click Ok..

怪我鬧 2024-12-30 09:08:19

如果您尝试将 jar 文件添加到您的 Android 应用程序中
就像这样

创建 lib 文件夹并复制 .jar 文件

在 Eclipse 中,右键单击现有项目,然后选择属性。将出现一个弹出窗口。(右键单击“项目属性”)。

箭头 在其中,选择 Java 构建路径,然后单击“库”选项卡,这里单击“添加外部 Jar”按钮,然后浏览您的 jar 文件(在 lib 文件夹中)并选择“确定”。

if you are trying to add a jar file to your android application
simply it's like this

create lib folder and copy the .jar file

In Eclipse, right click on your existing project, then choose properties. There will be a pop up window.(Right Click on Project Properties).

Arrow In that, select Java Build Path and then click on Libraries Tab, Here click on Add External Jar's button and then browse your jar file(in the lib folder) and select ok.

栖竹 2024-12-30 09:08:19

1)在项目中创建一个lib文件夹并将jar文件复制到其中。
2) 现在在 Eclipse 中右键单击您的项目并选择属性
3) 属性--> java构建路径-->图书馆-->添加罐子。
4)在添加jars中,您可以找到您的jar文件
5)将jar文件一一添加

1) Create a lib folder in your project and copy the jar files in it.
2) Now in Eclipse right click your project and select properties
3) Properties--> java build path--> Libraries--> Add Jars.
4) In the add jars you can able to find out your jar files
5) Add the jar files one by one

故事和酒 2024-12-30 09:08:19

在您的应用程序中创建一个文件夹并将 jar 文件粘贴到该文件夹​​中。
之后,转到 java 构建路径,然后从应用程序 jar 文件夹中选择 jar 文件,然后单击“确定”,我认为您的问题应该得到解决。
如果您有任何问题请告诉我。

create one folder in your application and paste jar file in that folder.
After that go to java build path then select jar file from your application jar folder and click ok, I think your problem should be resolve.
If you have any issue let me know.

生生漫 2024-12-30 09:08:19

也许它在新版本中发生了变化,但我必须做的是正常添加 jar 才能编译,然后确保我的 jar 文件也在 Java 构建路径设置的顺序和导出选项卡中选中。

Maybe it has changed in newer versions, but what I had to do was to add the jar as normal to be able to compile, then make sure that my jar file also is checked in the order and export tab of the Java Build Path settings.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文