All of the previous extension techniques create a monolithic, unchangeable product. If you wish to make your application or game more customizable, however, the obvious choice is to use plugins. These can be implemented either in Java or the native (C/C++) side, and they allow you to load in modules containing code.
For the Java side, things are pretty easy. Here, you have to create a DEX file (the equivalent of a JAR file). One way to do this is to take the .jar
or .apk
files containing our compiled Java code and run them through the dx
utility, which comes with the Android SDK, in the build-tools folder. Use it in this way:
dx --dex --output=classes.dex input.jar
This command will take the input file (a JAR file called input.jar
in this case) and output a matching DEX file. After this, repackage the DEX file into a JAR file (as a renamed ZIP file, or more complex, depending on your needs), and use Android's DexClassLoader
class (see http://developer.android.com/reference...