How to use and package a JAR file with my Android app?(如何在我的 Android 应用中使用和打包 JAR 文件?)
问题描述
我有一个 JAR 形式的 API,我想在我的 Android 应用程序中使用它.不确定它是否应该成为 Eclipse 中项目的一部分,或者单独保存并添加到项目属性中.这个JAR也需要和应用一起打包,那么Android应用是怎么做的呢?
如此解释 在评论中提到存在问题 (ClassNotFound),即使他确实声明了库.
他有:
但是,解决方案很简单:
浪费了1个多小时.伙计,我很生气!
解决方案:确保您的 JAR 是使用 1.6 而不是 1.7 编译的.
唉
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?
As explained by this SO question:
- Your Project -> right click -> Import -> Archive File ->
yourjar.jar
- Your Project -> right click -> Properties -> Java Build Path -> Libraries -> Add Jar ->
yourjar.jar
You must add it as "external JAR" files, and set the "Order and Export" in your Eclipse project.
Update February 2012:
Pacerier mentions in the comment having an issue (ClassNotFound) even though he did declare the library.
He had:
However, the solution was simple:
Over 1 hour wasted. Man was I pissed!
Solution: make sure your JAR is compiled with 1.6 and not 1.7.
Argh
这篇关于如何在我的 Android 应用中使用和打包 JAR 文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何在我的 Android 应用中使用和打包 JAR 文件?


基础教程推荐
- Java Keytool 导入证书后出错,"keytool error: java.io.FileNotFoundException &拒绝访问" 2022-01-01
- 如何使用 Java 创建 X509 证书? 2022-01-01
- FirebaseListAdapter 不推送聊天应用程序的单个项目 - Firebase-Ui 3.1 2022-01-01
- 无法使用修饰符“public final"访问 java.util.Ha 2022-01-01
- 降序排序:Java Map 2022-01-01
- 减少 JVM 暂停时间 >1 秒使用 UseConcMarkSweepGC 2022-01-01
- Java:带有char数组的println给出乱码 2022-01-01
- 在 Libgdx 中处理屏幕的正确方法 2022-01-01
- 设置 bean 时出现 Nullpointerexception 2022-01-01
- “未找到匹配项"使用 matcher 的 group 方法时 2022-01-01