Create an Android Jar library for distribution

psychotik picture psychotik · Feb 16, 2011 · Viewed 88.1k times · Source

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 source be available.

I'm looking for a way to build and distribute a closed-source library that can be used in other Android projects like a traditional JAR. This will require usage of the Android compiler, so it's not a vanilla-Java JAR file. FWIW, I do not need to embed resources/layouts in the JAR.

I've seen http://andparcel.com/ but it feels like a workaround, and I would rather use something 'officially supported' by Google. Also, I need to make sure that the JAR I build is compatible with old/new version of the Android SDK (i.e. I need a way to set the target platform version, etc).

Do the latest Android toolsets allow for the creation/consumption of JAR binaries? Can you point to some documentation on how I can do it?

Answer

Freddroid picture Freddroid · Dec 16, 2011

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.