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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T22:44:26+00:00 2026-05-14T22:44:26+00:00

Hello I am a beginning android developer using windows and the eclipse IDE to

  • 0

Hello I am a beginning android developer using windows and the eclipse IDE to develop java android applications.I have published one game but there is a free version of the game and a paid version. The google market insists that the different versions must have different package names. So far i have been refactoring the package with 2 different names and changing the R resource file import each time i build the different versions. The code is 99% the same for both versions.Is there a better way?

  • 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-05-14T22:44:27+00:00Added an answer on May 14, 2026 at 10:44 pm

    You have various discussions on this topic here and there, but basically the solution is akin to duplicate the project.

    For instance (not based on eclipse):

    It is difficult to answer this, since we don’t know what the difference is between the free and not-free versions of your app.

    I’m going to assume that the differences could be handled by some sort of global free/not-free flag. By that, I mean that the same code would make up both versions of the app, and which portions are enabled or used would be dependent on some public static data member somewhere:

    if (SomeClass.IS_PAID_APP) { 
            // add more stuff to menu, etc. 
    } 
    

    If you can organize your app that way, then you only need one code base.
    Have it set to build your app one way (free or paid, your choice) and with the proper package in your manifest for that version of the app.
    Then, add an Ant task that does the following:

    1. Makes a tree copy of your project dir to a temporary location
    2. Switch the copy of the manifest to the new package name via a
      search-and-replace
    3. Switch all import statements for your old package’s edition of R to
      the new package, again via search-and-replace, and again on the copy,
      not your original
    4. Change your IS_PAID_APP (or whatever) to the opposite value
      (search-and-replace in the copy)
    5. Executes an Ant build for the copy of the project
    6. Copies the binaries from that build to the main project’s bin/
      directory under a distinct name (so it doesn’t clobber your other copy
      of the APK)
    7. Deletes the tree copy made in step #1

    If Java had a pre-processor, this would be somewhat simpler. However, the basic technique that I describe above has been used for a couple of decades now. It’s clunky, but it works, and it means you only have one set of source code to deal with.
    Note that the Ant <replace> task would handle your search-and-replace stuff nicely.

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

Sidebar

Related Questions

I need a good tutorial using Eclipse Java EE for beginning web application development/servlets
Hello I'm beginning with android development I created two interfaces, the first a.xml and
Hello there people of stack overflow, I have just started developing with android and
I am beginning a new Java web application using Netbeans, and I would like
Hello i am trying to Create the beginning of a full screen game and
I have been reading the book called Beginning Android Games by Mario Zechner and
I am using System.Windows.Forms.RichTextBox and doing something like RichTextBox1.Text = Hello World; But after
Hello! I've been programming for a long time but just started developing for android,
Hello I have like this 2 tables class User public int UserId{get;set;} { ....
hello all i am working on a project in which i have a webpage

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.