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?

  • 8
    Because someone at Google remembers Dll Hell?
    – paulkayuk
    Dec 4, 2014 at 14:49

2 Answers 2


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.

  • 1
    The main advantage of centralized storage isn't disk space, it's that there is only one place where you need to apply a bug or even security fix. Dec 4, 2014 at 15:25
  • 2
    @CodesInChaos or create a bug in 3rd party code due to upgrading a shared library. DLL hell was not fun. Dec 4, 2014 at 15:56
  • @WyattBarnett I'm generally a fan of putting everything my application needs in the application directory, the security/bug fix issue is the only significant downside I know of. Dec 4, 2014 at 15:58
  • @WyattBarnett: Well, Linux distributions seem to handle shared libraries fine. But yes, without somebody managing it it's serious trouble.
    – Jan Hudec
    Dec 4, 2014 at 16:42
  • The argument about security model is totally bogus. In Linux different users also use the same shared libraries and it does not allow them to step on each others toes. Of course application A using library provided by package B would have to trust package B, but it still does it when it includes a copy.
    – Jan Hudec
    Dec 4, 2014 at 16:44

Android does have a facility for sharing libraries, but it is a little cumbersome to use so seems to be rarely used in practice. Applications that use Google Play Services, for instance, use this model.

The support library, however, specifically does not use this facility because it is expected that applications may be closely tied to a specific version of it, and the shared library system only allows a single version to be installed at a time.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.