With Android NDK, it is possible to produce shared libraries (also called dynamic libraries,
like DLL on Windows) as well as static libraries:
Shared libraries are a piece of executable loaded on demand. These are stored on
disk and loaded to memory as a whole. Only shared libraries can be loaded directly
from Java code.
Static libraries are embedded in a shared library during compilation. Binary code
is copied into a final library, without regards to code duplication (if embedded by
several different modules).
In contrast with shared libraries, static libraries can be stripped, which means that
unnecessary symbols (like a function which is never called from the embedding library) are
removed from the final binary. They make shared libraries bigger but "all-inclusive", without
Whether you should use a static or shared library depends on the context:
If a library is embedded in several other libraries
If almost all pieces of code are required to run
If a library needs to be selected dynamically at runtime
then consider turning it into a shared library because they avoid memory
duplication (which is a very sensible issue on mobile devices).
On the other hand:
If it is used in one or only a few places
If only part of its code is necessary to run
If loading it at the beginning of your application is not a concern
then consider turning it into a static library instead. It can be reduced in size at
compilation-time at the price of some possible duplication.
like DLL on Windows) as well as static libraries:
Shared libraries are a piece of executable loaded on demand. These are stored on
disk and loaded to memory as a whole. Only shared libraries can be loaded directly
from Java code.
Static libraries are embedded in a shared library during compilation. Binary code
is copied into a final library, without regards to code duplication (if embedded by
several different modules).
In contrast with shared libraries, static libraries can be stripped, which means that
unnecessary symbols (like a function which is never called from the embedding library) are
removed from the final binary. They make shared libraries bigger but "all-inclusive", without
dependencies. This avoids the "DLL not found" syndrome well known on Window.
Whether you should use a static or shared library depends on the context:
If a library is embedded in several other libraries
If almost all pieces of code are required to run
If a library needs to be selected dynamically at runtime
then consider turning it into a shared library because they avoid memory
duplication (which is a very sensible issue on mobile devices).
On the other hand:
If it is used in one or only a few places
If only part of its code is necessary to run
If loading it at the beginning of your application is not a concern
then consider turning it into a static library instead. It can be reduced in size at
compilation-time at the price of some possible duplication.