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

  • SEARCH
  • Home
  • 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 8732511
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T09:27:13+00:00 2026-06-13T09:27:13+00:00

I have developed one Android app in one project with Eclipse – it’s structured

  • 0

I have developed one Android app in one project with Eclipse – it’s structured (coming from iPhone) so one constant defines whether it’s the demo or the full version.

Now I have the problem that everytime I want to create the demo version I need to change the constant but also need to make a copy of the project with a different package name.

Obviously changing code in the original full version needs to be copied over to the demo or I would have to redo the creation of the demo app everytime I submit my app.

I see three possible approaches:

1.
While I have looked into library projects it is still unclear to me how this really provides a good solution in this case.

For example if I have the full version with an activity structure:

A1
A2
A3

using utility classes U1,U2

Certainly U1 and U2 can be in a library project and referenced from both projects – but the activities, strings.xml, graphics, layouts need to be duplicated (or is there another way that I don’t see?) This does not seem to be a good way forward and unfortunately has not been explained in similar questions on this topic when this approach was suggested.

2.
The other way would be to create different package names based on different build settings (similar to iPhone), however, this does not seem to be possible in Eclipse rather than by using some external scripts (which – honestly – i rather avoid since it seems rather error prone) while also the compilation has to be invoked outside Eclipse

3.
The probably most straight forward approach (and also currently with smalles effort) is to just manually copy the project, change the one constant, rename the package and compile/export every time I submit. This – however – seems to be rather “basic” and certainly does not look professional (as compared to iPhone/xCode build setting/target solution)

What would be the best approach (requiring minimum amount of changes and still being stable and easy to use) ?

Many thanks!

EDIT

For everyone who tried tim’s solution – it works fine, however I ran into a problem with custom attributes.

Check this: How to solve Android Libraries custom attributes and package name remapping during build?
it will solve the isse for libraries

  • 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-13T09:27:14+00:00Added an answer on June 13, 2026 at 9:27 am

    I’m doing this currently in eclipse, and it is not difficult.

    1. Convert existing source to library project.

    2. Create two new projects, free and paid.

    3. Include the library project in the free and paid projects.

    It’s not necessary to have a single Activity or resource inside the free/paid projects. All you need is a manifest for each which referenes the activities from your library. My free and full projects do not currently have a single java, resource, or layout file of any kind, it’s just a manifest which references activities from the library.

    I use the exact same code for both projects, and I differentiate them by saying :

    if(getApplicationContext().getPackageName().equals("full version package name")) {
        //do full stuff
    } else {
        //do free stuff
    }
    

    Some gotchas I’ve hit, especially if you’ve already released your app on the market:

    • If you change the full name/path of any activity, it will disappear from your homescreen. Therefore if your library has a different package name than the existing version, you will lose any homescreen icons. They can be replaced by the user but it’s not ideal.
    • Similar for appwidgets, if you change their receiver name, they will disappear on upgrade.
    • You may not under any circumstance change the package name of a released application.

    If you’ve already released a free and pro version, it’s somewhat unfortunate, because the activity path will need to change to a common library path, and you can’t rename the released package to match the library path. So somebody will have to lose their existing icons.

    In my case I had only released a free version before splitting them, and I was able to name the library with the same package name as the free version. I was skeptical that you’d be allowed to include a library with the same package name as the wrapper package, but apparently it’s possible to do so (working fine for me).

    So in my case I’ve got three projects:

    • Core Library: package name : com.myname.myapp
    • Free Version: package name : com.myname.myapp
    • Pro Version: package name : com.myname.myapp.Pro

    And the free and full version manifests add activities which are named com.myname.myapp.ActivityA or com.myname.myapp.ActivityB, which exist only in the library project.

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

Sidebar

Related Questions

I have developed a music app for Android. At one stage in the application,
I have one project with is developed in Php and javascript. How to open
in my project i have one registration form which is developed in C#.net.to this
I developed an app and tested in iPhone and iPad simulators. In the project
we have developed and Android app, first time, great fun. Now we are giving
Here I have developed one app. Here I wish to need the o/p like
Hi i have to developed one sample app.Here i wish to select the app
I have developed one application which is running properly in android 4.0(icecream Sandwhich) but
I developed one android app which is having sets of activities and one background
I have developed an Android app which I want to be available both as

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.