I know of Android Library projects, which allow you to create a shared-source project that can be pulled into Android Applications as needed. However, that requires that sou
Android doesn't provide a special kind of Android-JAR. But what you can do is adding a build.xml to your project and build the JAR with ant.
My build.xml looks like this:
<project name="MyAndroidLib" default="dist" basedir=".">
<description>
This is my Android lib
</description>
<!-- set global properties for this build -->
<property name="src" location="src" />
<property name="bin" location="bin" />
<target name="jar">
<jar destfile="MyAndroidLib.jar" basedir="bin/classes/">
<!-- replace 'com' by what ever you are using -->
<!-- as first part of the package name -->
<!-- e.g. de, org, ... -->
<!-- the ** is important to include the directory recursively -->
<include name="com/**" />
</jar>
</target>
</project>
Build the JAR by running ant jar
in your projects main folder.
.jar is just a .zip file which contains .class file (you can try change extension of any .jar file to .zip then see the result). Easily, you can create any .jar library for any purpose by zipping .class file.
just go to properties of the project of which you want to make jar.Click on Android tab. and tick in the Is library. now you can see .jar file in the bin folder.use it where you want to use.
Steps :
1) Open file project.properties
2) Add value android.library=true
3) Save file
4) From eclipse menu for project, select build automatically then select clean
Result : Brand new jar is created under bin.
If you create a Android Library project without having any resources, the ADT (first noticed in r16) will create a .jar with the same name as the project in the 'bin' folder.