0

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 Answers1

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.

Community
  • 1
  • 1
Mohammed Ali
  • 2,758
  • 5
  • 23
  • 41
  • My library contains more drawables and xml layouts.can we create jar and use it on other project ? – user3305353 Dec 08 '14 at 09:32
  • cannot create jar for android, see this http://stackoverflow.com/q/7973822/3879470, however if you make the project as library you can use its classes like you do for any other java project. – Mohammed Ali Dec 08 '14 at 10:18