0

I may be using the wrong terminology for what I am really asking. But let me describe what I need.

I have two separate apps, one was made first and the second was made later, but the second app has files that I have copy+pasted over from the first app. Now, there are separate apps and projects. But I was wondering if there is a way to to have 1 project but with 2 apps in it and be able to build/compile them as separate apps? This is so that I wouldn't need to have multiple copies of the same Java code in 2 separate places. I want to have the second app dependent on the first one, so that if I were to make a change I wouldn't need to make a change in multiple places.

I've googled and search for my problem, but I get solutions for including/adding 3rd party libraries and dependencies (which I already know how to do), but that's not what I need.

EDIT: I would need them to generate 2 separate APK files.

2
  • The build system of Android is Gradle, and it is flexible. Check this question. It will give you a hint. Commented Sep 16, 2015 at 19:34
  • @makata - I would need them to generate 2 separate APK files Commented Sep 16, 2015 at 20:20

1 Answer 1

1

Since you seem to not want to create your first project as a library, you could set up symbolic links from your second app to the source code of your first. They would remain two projects, and the second would link to the source code in the first.

Any shared code you changed in one, would be reflected in the other.

I'm assuming you are using Windows, so check this link out.

https://msdn.microsoft.com/en-us/library/windows/desktop/aa365680(v=vs.85).aspx

OSX Link: https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man7/symlink.7.html

As requested. GIT can save the value of symbolic links. With some configuration it can follow them if that's what's needed. Also, you could use a branch in git to accomplish the separation of projects with a shared branch.

How does git handle symbolic links?

Links on branches:

https://github.com/Kunena/Kunena-Forum/wiki/Create-a-new-branch-with-git-and-manage-branches http://git-scm.com/docs/git-branch

Sign up to request clarification or add additional context in comments.

9 Comments

Actually, I am using Mac. But a team member of mine is using Windows.
Also, I need them to generate 2 separate APK files.
You would still have two projects in Android Studio. The first project would be your original project. The other would be your second project that has symbolic links to the source/resource files needed from your first. You could still generate two APKs.
Thanks for the edit and providing the OSX link as well. Also, symbolic link would work, only problem is that every team member would have to create a symbolic link on their own environment (unless I'm wrong). Is there anyay other than symbolic links to provide what I need without forcing each dev environment to create the links individually?
How is your team all accessing the same code as it it right now? At some point you need replication across the team members.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.