title: Dynamically linking to a shared Java Library in Android
body: <p>I'm trying to separate a Java Library, that is used by multiple Android "services", into a dynamic or shared library that can be loaded by those independent services without having the library included into the APK of each service. </p>
  
  <p>I know there are different ways of doing this like creating an Android Service or using DexLoader and Reflection but I'm trying to avoid changing the source of the library. Instead I'm trying to build it and install it on my device (essentially extending the provided android API). </p>
  
  <p>The following is a very similar question which is still unanswered:
  <a href="https://stackoverflow.com/questions/8733530/create-android-apps-in-eclipse-sharing-common-library?answertab=active#tab-top">Create Android apps in Eclipse sharing common library</a></p>
  
  <p>I know this is something Google doesn't want to disclose so finding information online is extremely difficult.</p>
  
  <p>So far I've tried placing a simple "Hello World" program under the frameworks dir and build it which successfully created a jar for my program. Then I added my package in product/core.mk and in addition added my package definition under api/10.xml after which I ran "make sdk" which resulted in the following error message:</p>
  
  <pre><code>******************************
  You have tried to change the API from what has been previously released in
  an SDK.  Please fix the errors listed above.
  ******************************
  make: *** [out/target/common/obj/PACKAGING/checkapi-last-timestamp] Error 38
  </code></pre>
  
  <p>As a workaround I added my package into "public_api.xml" file, inside the out directory, which is somehow dynamically created during the build process. With this workaround the SDK is built with no errors (although if I do clean again I'll have to modify the public_api.xml again because it will be removed due to clean). However, when I try to import and use my package anywhere it still says that my package "does not exist"</p>
  
  <p>Any help will be greatly appreciated! Thank you!</p>