Why doesn’t Android use shared libraries

androidlibrarieslinux

In Android if you use a library in your app (such as the Support Library) the code for the library is duplicated on the device for each app that uses it.

Why can't android use the linux "shared library" concept, so each app wouldn't have to duplicate the library's code?

Best Answer

This is largely due to the security model. On Android, each application runs in its own silo. This is completely different to a desktop OS, where all applications have full access to all the user's data.

If we have two applications, A and B, that both use a shared library. If they used the same copy, then potentially application A could break into application B's silo - which is not desired.

As paulkayuk comments, this is also to avoid DLL Hell - problems caused by applications expecting different versions of a shared library. These days storage is cheap - even on mobile - so avoiding DLL Hell is more important than saving a bit of storage space.

Related Topic