On Android, two extension models are supported: Java archives for extensions developed with the Android SDK, and shared libraries for those developed with the Native Development Kit (NDK). Both are appropriate for some set of extensions; simply pick the one
that best suits your use case. (One can, of course, use JNI to bridge between Java and native code on Android, should that also be necessary.)
On Android, resources such as images are compiled into each application and accessed via constants in the generated class R. This mechanism doesn't support composition; there is only one instance of R available. Android extensions can include resources but,
to work around this limitation, they must be accessed via an API provided by the runtime.
To include resources in your Android extension, first place them in the "res" subdirectory of the Android platform directory, using the same naming conventions and file structure as for a regular Android application. At packaging time, resources from all extensions
are merged into the resources directory of the main application. In order to avoid name conflicts, extensions should use a unique prefix for their resources.
These resources will be merged, as will the code in the Java archive, into the compiled dex and resources files of the main application. They can then be accessed via the FREContext.getResourceId() method,
which takes the desired resource ID as an argument. In other words, instead of accessing an image as, for example, R.drawable.background_image, use getResourceId(
Note that this API is available only in Java, as the Android resource mechanism is a Java construct, not expected to be accessed by extensions using native Android development.
The Java FREContext class also provides, on Android only, a getActivity() method
that returns the main application Activity, which in turn is required by a variety of Android APIs.