如何将android库项目转换为.jar文件与所有的类和资源? [英] How to convert android library project to .jar file with all classes and resources?

查看:155
本文介绍了如何将android库项目转换为.jar文件与所有的类和资源?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要将android项目转换为.jar文件与所有的类和资源。我们可以选择这样做吗?我试图通过转换到android库项目然后到jar文件。它总是显示空指针异常。

I need to convert android project to .jar file with all classes and resources.can we have a option to do that ? I tried by converting to android library project and then to jar file.It always shows null pointer exception.

推荐答案

如果你的库是纯粹的Java代码,没有资源,你可以从.class文件中创建一个JAR,就像使用常规Java一样:

If your library is purely Java code, with no resources, you can create a JAR out of the .class files, just as you would with regular Java:

1. Right click the project.
2. Export --> Java --> JAR file.
3. Tick the files to include and name the jar, click "Next".

对于逐步的详细信息,请参阅这个
对于android,请参阅此 ans

For step by step details incase of java see this. For android see this 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.

编辑:

以使用图书馆请参阅

这篇关于如何将android库项目转换为.jar文件与所有的类和资源?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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