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 8882149
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T20:30:19+00:00 2026-06-14T20:30:19+00:00

The standard advice for sharing code & resources between Android projects is to use

  • 0

The standard advice for sharing code & resources between Android projects is to use a library. Personally I find this works poorly if (a) the shared code changes a lot, or (b) your computer isn’t fast enough.

I also don’t want to get into deploying multiple APK’s, which seems to be necessary when I use dependent projects (i.e. Java Build Path, Projects Tab).

On the other hand, sharing a folder of source code by using the Eclipse linked source feature works great (Java Build Path, Source tab, Link Source button), but for these two issues:

1) I can’t use the same technique to share resources. I can create the link to the resources parent folder but then things get wonky and the shared resources don’t get compiled (I’m using ADT 21).

2) So then I settle for copying the shared resources into each project, but this doesn’t work because either. The shared code can’t import the copy of its resources because it doesn’t know the package name of the project that uses it. The solution I’ve been using is to access the resources dynamically, but that has become cumbersome as the number of resources grows.

So, I need a solution to either (1) or (2), or I’ll have to go back to a library project. (Or maybe there is another option I haven’t thought of?)

  • 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-14T20:30:20+00:00Added an answer on June 14, 2026 at 8:30 pm

    Your real problem is (2). Fixing (1) would eliminate some copying, but you would still run into problems with (2).

    Unfortunately, that really isn’t possible. There’s a fair bit of fancy footwork that goes on to make multiple packages possible with library projects, and there’s no good way to get that same result without library projects. Anything in res/ of a project is accessed via that project’s R class, including your copied resources.

    The solution I’ve been using is to access the resources dynamically

    I translated that into you using getIdentifier(). That certainly works. Another approach is to having the hosting app supply resource IDs as parameters to the library code — this is the pattern that the Android SDK itself uses. This is faster at runtime than the reflection-based getIdentifier(), and it gives the hosting app somewhat more flexibility, but you do wind up adding a bunch of parameters to your methods and constructors as needed to supply the various project-specific R values.

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

Sidebar

Related Questions

I follow the advice to implement Android device (not application!) independent library code for
When I use Xcode (3.1.4 Leopard) to code in plain C (using the Standard
I'm not sure how to do this, and can use some advice. I created
This question has 2 parts: 1) I'm new to Android development and find implementing
I copied this code from the libjpeg example and im passing it standard files;
If for example I should not use standard library functions like printf() , putchar()
Can anyone check and advice if my code is standard for mobile device? I
The MPI standard (page 295) says: Advice to users. Whether the errorcode is returned
I don't need advice about the JavaScript code but about the files organization. I
I’m after a bit of advice on the best way to go about this

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.