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

蹲街弑〆低调 提交于 2020-01-07 03:12:27

问题


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.


回答1:


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".

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.

EDIT:
For using drawables of the library see this.



来源:https://stackoverflow.com/questions/27354555/how-to-convert-android-library-project-to-jar-file-with-all-classes-and-resourc

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!