0

I'd like to create another app from my main app, for instace 'app with ad'. For now i created branch in my repo, change the main source as i wanted and .. what's now? If i build the new one it will be named as my 'main app'..
How to easy deal it?

Please help.

xliiv
  • 5,399
  • 5
  • 29
  • 35
  • Typically you want to create 2 versions of same app, one with ads and another without ads??? – Raghav Jun 23 '12 at 11:11
  • yup, the differences between two code versions are little (only AdView added to one Activity? roughly speaking..) But project properties is the main problem, i think.. – xliiv Jun 23 '12 at 15:34

1 Answers1

1

Step #1: Move common business logic into an Android library project.

Step #2: Have each flavor of your app ("main app" and "app with ad") reference the common code and resources from the Android library project.

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
  • It's interesting concept, but does it mean i need to have 3 repos? Like, one for common libs, one for 'main' app and one for 'app with ad'? – xliiv Jun 23 '12 at 15:36
  • 1
    @xliiv: What are you considering a "repo" to be? – CommonsWare Jun 23 '12 at 15:50
  • 1
    @xliiv: That did not clarify things very much. If you are referring to a version control (e.g., git) repository, no, they can all be in one. For example, I publish a variety of open source components as Android library projects, with a `demo/` sub-project in the same repository. – CommonsWare Jun 24 '12 at 12:18
  • could You reference an open source project as an example to clarify? – xliiv Jun 24 '12 at 19:42
  • I saw the project and I understand the part of project tree (with libs in src and apps using the libs in demo directory.. ). But how do You build|run it? I'm eclipse guy and usually i just click "Run as > Android application", how to deal it with Your structure? – xliiv Jun 25 '12 at 06:45
  • 1
    @xliiv: I click "Run as > Android application", the same as anyone else... but only on the `demo/` project. I have both the top-level and the `demo/` project in my Eclipse workspace. – CommonsWare Jun 25 '12 at 11:03