【发布时间】:2014-12-08 09:03:24
【问题描述】:
我需要将 android 项目转换为包含所有类和资源的 .jar 文件。我们可以选择这样做吗?我尝试转换为android库项目,然后转换为jar文件。它总是显示空指针异常。
【问题讨论】:
我需要将 android 项目转换为包含所有类和资源的 .jar 文件。我们可以选择这样做吗?我尝试转换为android库项目,然后转换为jar文件。它总是显示空指针异常。
【问题讨论】:
如果您的库是纯 Java 代码,没有资源,您可以使用 .class 文件创建 JAR,就像使用常规 Java 一样:
1. Right click the project.
2. Export --> Java --> JAR file.
3. Tick the files to include and name the jar, click "Next".
有关 java 的分步详细信息,请参阅this。 对于 Android,请参阅此 ans。
You cannot export the library project to a self-contained JAR file, as you would do for
a true library. Instead, you must compile the library indirectly, by referencing
the library in the dependent application and building that application.
编辑:
有关使用库的可绘制对象,请参阅this。
【讨论】: