简体   繁体   English

如何将所有类和资源的android库项目转换为.jar文件?

[英]How to convert android library project to .jar file with all classes and resources?

I need to convert android project to .jar file with all classes and resources.can we have a option to do that ? 我需要使用所有类和资源将android项目转换为.jar文件。我们可以选择这样做吗? I tried by converting to android library project and then to jar file.It always shows null pointer exception. 我尝试先转换为android库项目,然后转换为jar文件,它始终显示空指针异常。

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: 如果您的库是纯Java代码,没有资源,则可以像使用常规Java一样从.class文件中创建JAR:

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

For step by step details incase of java see this . 有关Java的逐步详细信息,请参见this For android see this ans . 对于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.

EDIT: 编辑:
For using drawables of the library see this . 有关使用库的drawable的信息,请参见this

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM