I struggled to actually implement this, but figured it out. I feel the best approach is to use the Android Library feature, and differentiate with an app name string value in each project simple paid=true string value (or key file if you want a more complex solution).
Exact steps:
Library
Use this to get a 'common' copy of code, then multiple android projects that reference it`
Purpose:
Free & Paid version on Google Market
Results:
One Android Project (library) with ALL code, with 2 additional Android Project that reference code, but no actual classes. strings.xml differentiates App names (Paid & Free or whatever)`
Create Library
- Create new project & during steps to create select option to make library
- Convert existing: right click project->Properties->Android->Check box next to library.
- Might want to refactor/rename as well, but not needed
Create new project to utilize library
- Create new Android Application Project
- Open properties for this project->Android->Add existing library to project
- Additional Libraries if exist: Dont copy these (jar) files into new project!
- Properties of new project->Build Path->Configure Build Path->Libraries Tab->Add Jars->Expand Library you're linking to->libs->Select libary (ie libGoogleAnalytic)->OK->Order & Exports tab->Check new library->ok
- Manifest of new project: Need to RE call out ALL info from library, especially activities, appending FQDN from library
- ie: android:name="com.blah.appname.library.MainActivity" (basically copy/paste everything from library manifest to new project manifest & adjust package name to reference library instead)
- Make sure there aren't any duplicate libraries in new project lib folder vs library project! If so, delete from new project & adjust build path per step above
- Do not need ANY classes/java files!
- Replace resources only if you want them replaced
- Delete all files in new Project in res\drawable\ so we utilize the ones from the library