Davide Berra
Davide Berra

Reputation: 6568

Android and linked libraries

Maybe the question can sound silly for the java users. Sorry, i'm a noob.

I'm wondering how libraries are loaded during runtime in an Android system.

Let's say i have a super simple android app that only call a function located in javax.net.ssl package.

The jar (dex) containing javax.net.ssl stuff will be inserted into the apk (turning it into a static library)? Or during the runtime, the Dalvik VM will link to the jar (or dex) file installed on the android machine? Or just the Dalvik VM was compiled to contain every javax include itself?

Thanks in advance

Upvotes: 1

Views: 118

Answers (1)

Chris Stratton
Chris Stratton

Reputation: 40357

They are in effect dynamically linked at runtime by loading additional optimized dex code stored on the device.

In actuality for many components this happens once at system startup, with the process and virtual machine contained therein that becomes each application inheriting read only access to a shared copy already in memory.

Native libraries work about the same way only the linkage happens below the level of the virtual machine, in the process itself.

Upvotes: 2

Related Questions