Saturday, November 5, 2011

AIR for Android using external jar files in an extension

If you use a third-party jar file (i.e. not part of the regular Android SDK), you have to merge that jar into your own extension jar file.

For example, suppose your main extension jar file is extension.jar and you are using code in external.jar. Then you can put the classes from external.jar into extension.jar using the Java jar tool:

jar -xf external.jar

This will extract the .class files into package folders. If the top-level package is "com", then you can add those to extension.jar with:

jar -uf extension.jar com