title: Android/Java libraries
body: <p>These questions are my attempt at understanding how Android handles JAR files and external libraries, etc. It's conceptual.</p>
  
  <p>In Java, there is a JAR file rt.jar that comes with the JRE, so that every application has access to the java core libraries. </p>
  
  <ol>
  <li><p>Does the Java classloader load classes only as they're needed by the application?</p></li>
  <li><p>Is rt.jar equivalent to android's /system/framework/ jars?</p></li>
  <li><p>When we develop an app with the SDK, we include android.jar from one of the android APIs. Is android.jar essentially the compiled AOSP for that API (minus some hidden libraries)?</p></li>
  <li><p>android.jar isn't actually included with an APK, is it? Once on a device, the APK is using /system/framework/framework.jar, correct?</p></li>
  <li><p>If yes to 4, how does android tell an application to use that library? Is this something I can view the source code for?</p></li>
  <li><p>When we add a JAR to an Android project, is this just like including a static library? The code from the library is just compiled into classes.dex like the rest of the project?</p></li>
  <li><p>When we add an android library project to an application, is it also compiled into classes.dex? The only difference between this and 6 is that a library project can contain resources?</p></li>
  <li><p>If every app is referencing /system/framework/framework.jar (and others, like services.jar etc.), then are there a bunch of instances of that library running at one time on the device? Is it like a dynamic library that gets loaded into memory multiple times?</p></li>
  </ol>
  
  <p>I'd love answers to all these questions, but I'd also appreciate suggestions to some good places to read about these things.</p>