Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8024581
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T22:54:22+00:00 2026-06-04T22:54:22+00:00

I’m trying to separate a Java Library, that is used by multiple Android services,

  • 0

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.

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).

The following is a very similar question which is still unanswered:
Create Android apps in Eclipse sharing common library

I know this is something Google doesn’t want to disclose so finding information online is extremely difficult.

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:

******************************
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

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”

Any help will be greatly appreciated! Thank you!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T22:54:23+00:00Added an answer on June 4, 2026 at 10:54 pm

    Finally figured it out. The solution turns out to be very simple!

    Place your library in the frameworks/base folder and make sure all your source code is inside under java directory like so:

    ../frameworks/base/HelloWorld/java/<source files and folders>
    

    Edit core.mk file located under build/target/product/ to include your package in the list. This will add HelloWorld library to the framework:

    PRODUCT_PACKAGES := \
        bouncycastle \
        :
        :
        DefaultContainerService \
        Bugreport \
        HelloWorld
    

    Edit pathmap.mk file located under build/core/ to include your directory in the list. This will add HelloWorld library to the android.jar

    FRAMEWORKS_BASE_SUBDIRS := \
        $(addsuffix /java, \
            core \
            graphics \
            location \
            media \
            opengl \
            sax \
            telephony \
            wifi \
            vpn \
            keystore \
            voip \
            HelloWorld \
         )
    

    Done. rebuild android and it should not complain and add your library to framework.jar!

    I hope this helps.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I'm trying to create an if statement in PHP that prevents a single post
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I used javascript for loading a picture on my website depending on which small
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.